c# selenium chrome-webdriver write advanced Path (

2019-06-10 05:08发布

I just try to write correct path to click exactly this button what I want on my page. I will give you an example page for testing. You just have to download the HTML file and open it in your browser.Code of HTML page What we now want to do? If you run this HTML file you will see all page. And now we want to make a Click on exactly this button on screen : enter image description here After when you click on this button you will see click counter below: like this : enter image description here

Have anyone idea how to click it? I tried few ways and can't find solution still. Please help. I try at least :

drive.FindElement(By.XPath("//tr[class='ng-scope']/td[text()='Wylaczenie nadan RDF'] and button[@title='Skip']")).Click();

and

drive.FindElement(By.XPath("//tr[text()='Wylaczenie nadan RDF']/button[@title='Skip']")).Click();

+ more and more and can't just write fine this Path to click exacly this button. And unique value is <td class="ng-binding">Wylaczenie nadan RDF</td> - i prefer to get path by this.

1条回答
来,给爷笑一个
2楼-- · 2019-06-10 06:01

You need to use below XPATH for the same

//tr[td='Wylaczenie nadan RDF']//button[@title='Skip']"

//tr[td='Wylaczenie nadan RDF'] will take you to the row which contains that text and then you use //button[@title='Skip'] to find that button

查看更多
登录 后发表回答