Tag Info

New answers tagged


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();


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.


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


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