package browser

import (
	"strings"
	"testing"
)

func TestCdpClickText_nilConn(t *testing.T) {
	if err := CdpClickText(nil, "Submit", FindByTextOpts{}); err == nil {
		t.Fatal("expected error on nil conn")
	}
}

func TestCdpClickText_emptyText(t *testing.T) {
	c := &CDPConn{}
	err := CdpClickText(c, "", FindByTextOpts{})
	if err == nil {
		t.Fatal("expected error on empty text")
	}
	if !strings.Contains(err.Error(), "cdp click text") {
		t.Fatalf("error no incluye prefijo: %v", err)
	}
}
