Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Locating element in the dom with parent selenium xpath

I am trying to select a checkbox from table td element, but Selenium is not finding the element, this is my xpath locator "//*/td/a[contains(.,'Samsung Galaxy Note 10.1')]//parent::td[last()]/input[@type='checkbox']". I need to click on input filed with type checkbox, depending on the text in the with the Galaxy text.

Dom

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use this xpath

//a[contains(text(),'Samsung GALAXY Note 10.1')]/../following-sibling::td[last()]//input[@type='checkbox']

You are looking for Samsung Galaxy Note 10.1, instead, it is Samsung GALAXY Note 10.1

if this is unique //a[contains(text(),'Samsung GALAXY Note 10.1')] then the XPath provided by me should work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading