Tag Info

New answers tagged

2

Create a string variable and use it (for example) as follows: string strMyXPath = "//*[@id='" + recordId + "_ACTION_COLUMN']/a[2]/span"; driver.FindElement(By.XPath(strMyXPath)).Click();


0

Just a wild guess without any testing, but shouldn't it just be: find_element(:xpath,"//*[contains(.,'602384710')]../..").click The problem is that when searching with the results of a find_element it cannot go back up the tree anymore, from then on it will only search within the already found results.


0

I have tested this XPath online. Please try: //a[contains(.//div,602384710)]


0

You have two options. If you're using findElement relative to another WebElement, your XPath needs to start with a dot (the element as your starting point). See the accepted answer in this topic. Alternatively, the XPath contains goes looking in child nodes too. You could try to immediately target the link element like so: "//a[@class='tv-card-link' ...



Top 50 recent answers are included