0
votes

Wants to locate element with multiple condition on particular row,

I want to Click on div which contains ng-click="condition001" which has parent link contains Auto-001

So query become like : Select element xpath("//div[contains(@ng-click,'condition001')]") where Link("Auto-001")

<tr ng-repeat="(abc, xyz)" ng-show="data.length > 0">
                <td class="x001">
                    <div class="x002">
                        <a class="x003" href="#">Auto-001</a>                           
                    </div>              
                </td>

                <td class="x004">
                    <div class="x005">
                        <div class="x006">
                            <div class="x007" ng-click="condition001" tabindex="0">
                                <i class="x008"></i>
                            </div>
                        </div>
                    </div>
                </td>
</tr>

Please suggest relevant xpath code which can work for above criteria,

1
Which Selenium Language Binding Art are you using? Java / Python / C# - DebanjanB
Its Java language. - Ishita Shah

1 Answers

0
votes

To click on the WebElement identified through xpath as ("//div[contains(@ng-click,'condition001')]") where it has partialLinkText as ("Auto-001") you can use the following line of Java code :

WebElement myElem = new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@class='x003' and contains(.,'Auto-001')]//following::td[1]//div[@class='x007' and @ng-click='condition001']")));