javascript - How to retrieve the text of an element and write it to a file for later retrieval in protractor using angular js -
so, have check status of action started automation script using automation script. in order track action, have capture id , write file can read second script action. problem having unable action id number using gettext(). instead, keep seeing other non sensical text when check content of file or variable first store id.
the html code action id is:
<dd class="ng-binding">232</dd>
i trying capture id (#232 here) this:
var id = element(by.xpath('html/body/div[1]/div[2]/div/div[2]/div/div[2]/div[3]/dl/dd[1]')).gettext();
upon executing automation script, console output shows var id:
id:[object object]
i have verified using protractor elementexplorer xpath points right element , can extract id , displays on screen correctly. not work when trying store same id variable , write file can retrieve later use. or hints on how appreciated.
gettext()
returns promise, have resolve it, using absolute xpath bad way of locating elements. have tried locating cssselector
?
element(by.css('dd.ng-binding')).gettext().then(function(text) { console.log(text); });
Comments
Post a Comment