New answers tagged xpath
First off, either you mistyped the HTML or the HTML is malformed -- note the two consecutive <tr> tags. That aside, rather than answer the question, I suggest you look at this StackOverflow question on using sibling operators in XPath.
As the list is shown in iframe so you need to switch to iframe first then try to find out the elements. so your code should be WebElement iframe = driver.findElement(By.xpath("//iframe[@class='sa-shim']")); driver.switchTo().frame(iframe); List<WebElement> list= ...
As Per my understanding you script is following steps : Open yahoo Search selenium Get list of links which are present in More link So get list of elements(links) List<WebElement> list= driver.findElements(By.xpath("//div[@class='yui3-menu-content']/ul/li/a")); Note : Further step that you perform is to click on first link so for that folow ...
You're trying to find a dynamically generated id using a static string. Everytime you go to the page 'yui_3_12_0_1_1460454396950_758' and 'yui_3_12_0_1_1460' will change. You have to find another way to find them.
Top 50 recent answers are included