java - Selenium Webdriver click specific WebElement -


i have following html , td class tree-label-name ng-binding , text() approver selected (clicked)

html:

<?xml version="1.0" encoding="utf-8"?> <treecontrol tree-model="vm.homestats" expand-level="0" on-selection="vm.selectstatsnode(node)" on-node-toggle="vm.toggletreenode(node, expanded)" expanded-nodes="vm.expandednodes" selected-node="vm.selectednode" class="ng-isolate-scope">    <ul class="ng-scope">       <li ng-repeat="node in node.children | filter:filterexpression:filtercomparator" ng-class="headclass(node)" class="ng-scope tree-collapsed tree-selected">          <i class="tree-branch-head" ng-class="ibranchclass()" ng-click="selectnodehead(node)"></i><i class="tree-leaf-head "></i>          <div class="tree-label  tree-selected" ng-class="selectedclass()" ng-click="selectnodelabel(node)" tree-transclude="">             <table class="ng-scope">                <tbody>                   <tr>                      <td class="tree-label-icon"><img bf-image-path="user" class="tree-icon" src="/assets/img/icons/user.png"></td>                      <td class="tree-label-name ng-binding">                         strydom, aj (rico)<br>                         <progress-bar ng-if="::!node.isfolder" value="6" max-value="230" class="ng-scope">                            <div class="progress-bar" ng-style="barstyles">                               <div class="progress-bar-value" ng-style="valuestyles" style="width: 2.6087%;"></div>                            </div>                         </progress-bar>                      </td>                      <td width="30" class="text-right">                       <strong class="process-bar-total ng-binding ng-scope" ng-if="::!node.isfolder">6</strong><!-- end ngif: ::!node.isfolder -->                      </td>                   </tr>                </tbody>             </table>          </div>       </li>       <li ng-repeat="node in node.children | filter:filterexpression:filtercomparator" ng-class="headclass(node)" class="ng-scope tree-collapsed">          <i class="tree-branch-head" ng-class="ibranchclass()" ng-click="selectnodehead(node)"></i><i class="tree-leaf-head "></i>          <div class="tree-label " ng-class="selectedclass()" ng-click="selectnodelabel(node)" tree-transclude="">             <table class="ng-scope">                <tbody>                   <tr>                      <td class="tree-label-icon"><img bf-image-path="team" class="tree-icon" src="/assets/img/icons/team.png"></td>                      <td class="tree-label-name ng-binding">                         approver<br>                         <progress-bar ng-if="::!node.isfolder" value="1" max-value="230" class="ng-scope">                            <div class="progress-bar" ng-style="barstyles">                               <div class="progress-bar-value" ng-style="valuestyles" style="width: 0.434783%;"></div>                            </div>                         </progress-bar>                      </td>                      <td width="30" class="text-right">                      <strong class="process-bar-total ng-binding ng-scope" ng-if="::!node.isfolder">1</strong><!-- end ngif: ::!node.isfolder -->                      </td>                   </tr>                </tbody>             </table>          </div>       </li>       <li ng-repeat="node in node.children | filter:filterexpression:filtercomparator" ng-class="headclass(node)" class="ng-scope tree-collapsed">          <i class="tree-branch-head" ng-class="ibranchclass()" ng-click="selectnodehead(node)"></i><i class="tree-leaf-head "></i>          <div class="tree-label " ng-class="selectedclass()" ng-click="selectnodelabel(node)" tree-transclude="">             <table class="ng-scope">                <tbody>                   <tr>                      <td class="tree-label-icon"><img bf-image-path="team" class="tree-icon" src="/assets/img/icons/team.png"></td>                      <td class="tree-label-name ng-binding">                         assigner<br>                         <progress-bar ng-if="::!node.isfolder" value="230" max-value="230" class="ng-scope">                            <div class="progress-bar" ng-style="barstyles">                               <div class="progress-bar-value" ng-style="valuestyles" style="width: 100%;"></div>                            </div>                         </progress-bar>                      </td>                      <td width="30" class="text-right">                       <strong class="process-bar-total ng-binding ng-scope" ng-if="::!node.isfolder">230</strong><!-- end ngif: ::!node.isfolder -->                      </td>                   </tr>                </tbody>             </table>          </div>       </li>    </ul> </treecontrol> 

this code not seem perform click action.

webelement inboxtypetoselect =  webdriver.findelement(by.xpath("//treecontrol[@class='ng-isolate-scope']/ul/li/div/table/tbody/tr/td[@class='tree-label-name ng-binding' , normalize-space(text() = '" +  inboxtype + "')]")); actions action = new actions(webdriver); action.click(inboxtypetoselect); action.perform(); 

the value passed inboxtype approver xpath is:

//treecontrol[@class='ng-isolate-scope']/ul/li/div/table/tbody/tr/td[@class='tree-label-name ng-binding' , normalize-space(text() = 'approver')] 

any idea why action not performed?

try following xpath:

//tr/td[contains(text(),"approver")] 

try follows:

 webelement inboxtypetoselect =  webdriver.findelement(by.xpath("//tr/td[contains(text(),"approver")]"));     actions action = new actions(webdriver);     action.click(inboxtypetoselect).perform(); 

call perform() after click method.

instead of action chains use click on webelement itself.

webelement inboxtypetoselect =  webdriver.findelement(by.xpath("//tr/td[contains(text(),"approver")]")); inboxtypetoselect.click(); 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -