Wilson Wilson - 1 year ago 185
Python Question

Find element by xpath in selenium, with partial match

I have a code to find an element that looks like this:


Id like to be able to find it only using:


But that does not work. I basically do not want to have to deal with the td[7]. Is this possible?

Answer Source

If there is just one link inside that table row you can use:


If there are multiple links inside that table row you might need to add an id to the <a> element or a special class attribute and use that for selection:

by id:


by class:


or if multiple classes are assigned:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download