node.js - Firebug identified xpath not working in protractor -
firebug identified xpath not working in protractor.i ahve cretaed xpath using firebug.when identify xpath using ide,it working fine.however when use same xpath in protractor,it not working.my element not have id or name.so here can use xpath option.
please find below image reference. here need verify whether particular element has "irctc attractions" text.
could please me?
html code:
//div style="width:100%;" class="g_hedtext">irctc attractions /div
ok, looking @ error message (in comment):
exception loading: syntaxerror: c:\users\xxxx\appdata\roaming\npm\tc_model2.js:7 var disclaimermessage = element(by.xpath('//[@id='disclaimer-message']')); ^^^^^^^^^^ unexpected identifier
(i'm guessing carets before "unexpected identifier" aligned. right?)
the problem you've used single quotes both delimit string 'disclaimer-message'
, , delimit whole xpath expression '//[@id='disclaimer-message']'
. appears parser xpath expression stuff between first 2 single quotes: '//[@id='
, , disclaimer-message
other identifier without comma or other operator show it's doing there.
the solution use double quotes inside xpath expression. xpath accepts either single or double quotes; doesn't care, long match them each other. change offending line to
var disclaimermessage = element(by.xpath('//[@id="disclaimer-message"]'));
and should go.
for future reference, question have been quicker , easier answer if had told error message in first place.
Comments
Post a Comment