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="screening_questions[0].multiple_choice[0]-dealbreakerField" value="on" style="position: absolute; cursor: inherit; pointer-events: all; opacity: 0; width: 100%; height: 100%; z-index: 2; left: 0px; box-sizing: border-box; padding: 0px; margin: 0px;>
Since the element has id attribute, so I tried to locate it by using its id value but it didn't work.
If I search for that element in chrome console as:
$('#screening_questions[0].multiple_choice[0]-dealbreakerField')
I get the exception: Uncaught DOMException:
Failed to execute '$' on 'CommandLineAPI': '#screening_questions[0].multiple_choice[0]-dealbreakerField' is not a valid selector.
I thought it will be pretty straight forward to locate it given its id value. Could you please suggest what could be wrong here?