javascript - Protractor - Get text from table -
i have list of "cases" in table, need find specific 1 name , click on it.
my html looks like:
<tr ng-repeat-start="case in cases | orderby:order:order_reverse" class="middle ng-scope odd readonly" ng-class-odd="'odd'" ng-class-even="'even'" ng-class="{readonly: !casemanager.iswritable(case)}"> <td> <span ax-sharing-circle="shared_with_partner" class="ng-isolate-scope"><span class="icon sharing-circle sharing-circle-left" title="sdílený"></span></span> </td> <td class="case-table-claim-number fix-v-align"> <a ui-sref="case.general({caseid: case.caseid})" class="ng-binding" href="#/case/0a0b1c2a-94b4-444c-a2b8-c62cbd3532ae/general">20150629-165000-65</a> </td> <td class="case-table-claim-number fix-v-align ng-binding"></td> <td class="case-table-claim-number fix-v-align ng-binding"></td> <td class="case-table-make fix-v-align ng-binding"></td> <td class="case-table-make fix-v-align ng-binding"></td> <td class="case-table-status fix-v-align ng-binding"> 29.6.2015 </td> <td class="case-table-status fix-v-align ng-binding"></td> <td> <span class="glyphicon glyphicon-menu-down" ng-class="{ 'glyphicon glyphicon-menu-up': hasoverview(case.caseid), 'glyphicon glyphicon-menu-down': !hasoverview(case.caseid), }" ng-click="toggleoverview(case.caseid)"></span> </td> </tr>
in example above can find string 20150629-165000-65
name of case.
i try write this:
element(by.csscontainingtext('a', global.casenumber)).click();
which should find element , click on it, instead of throw error:
no element found using locator: by.csscontainingtext("a", "20150629-165000-65")
can advise me how this?
there relevant by.linktext()
locator should fit use case:
var link = element(by.linktext(global.casenumber));
if still doesn't find desired element, try adding wait:
var ec = protractor.expectedconditions; browser.wait(ec.presenceof(link), 5000);
Comments
Post a Comment