2

could someone point me to solution how to find some selector if you know only part of its ID?

As an example, there is a page with input field NAME which ID is :firstname: So, to found this selector by the common way is Selector("#firstname"). But what if I want to found selector which contains string "name" in its ID?

This is a workaround for me. Because on-page there is a selector "#\27 contactName > div > input" End because of this character "\27" which is equal to ' sign, testcafe framework cannot found such selector in DOM tree.

I have tried: Selector("#\27 contactName > div > input") or Selector("#'contactName > div > input"), but it does not help.

I understand and know that this is not a problem with Testcafe, but with web coders :D. Agree. But still, how to solve it?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47

1 Answers1

4

Try this.

$("[id*='name']").val

and your jquery as you want

You can also add your tags like.

$("input[id*='name']").val

or any you like

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Avi
  • 1,424
  • 1
  • 11
  • 32