I am writing automation UI tests for my web page using selenium. I have an element on the web page which I am testing:
<< input type=\"checkbox\" id
This error message...
Failed to execute '$' on 'CommandLineAPI': '#screening_questions[0].multiple_choice[0]-dealbreakerField' is not a valid selector.
...implies that the Locator Strategy you have adapted is not a valid selector.
As per the HTML you have shared the desired element is a <input>
tag with type
attribute as checkbox
and to use the id
attribute you have to escape the .
characters and you can use either of the following options :
cssSelector :
"input[id=\"screening_questions[0].multiple_choice[0]-dealbreakerField\"][type='checkbox']"
xpath :
"//input[@id=\"screening_questions[0].multiple_choice[0]-dealbreakerField\"][@type='checkbox']"