0

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.

Gokul
  • 788
  • 2
  • 12
  • 30
Michael
  • 202
  • 1
  • 3
  • 13
  • Possible duplicate of [c# selenium chrome-webdrive clicking button using class and title](https://stackoverflow.com/questions/46601482/c-sharp-selenium-chrome-webdrive-clicking-button-using-class-and-title) – JOberloh Oct 06 '17 at 18:37
  • Do not post duplicate questions when you already have asked your question. – JOberloh Oct 06 '17 at 18:38

1 Answers1

1

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

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265
  • I already offered him this solution here: https://stackoverflow.com/questions/46601482/c-sharp-selenium-chrome-webdrive-clicking-button-using-class-and-title/46606448?noredirect=1#comment80172207_46606448 – JOberloh Oct 06 '17 at 18:39
  • @JonahOberloh, you needed `//button` instead of `/button` – Tarun Lalwani Oct 06 '17 at 18:48