any help is appreciated.
I am wondering if the firebug copy xpath always working for webdriver.
I have a page with a list, I could get the full xpath to find the first two elements, but could not do the same for 3, 4th.
For 3rd one it's not working:
WebElement element3=driver.findElement(By.xpath("/html/body/div[6]/div[2]/div/div[3]/div/div[3]/div/div[4]/div/div[4]/div/div/div/div[1]/div[2]/div[1]/div/div[2]/div/div[2]/div[1]/div/div[2]/div[1]/table/tbody[2]/tr[3]/td[5]/div"));
Error:
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"/html/body/div[6]/div[2]/div/div[3]/div/div[3]/div/div[4]/div/div[4]/div/div/div/div[1]/div[2]/div[1]/div/div[2]/div/div[2]/div[1]/div/div[2]/div[1]/table/tbody[2]/tr[3]/td[5]/div"}
My HTML:
<tr class="GKWRNW-BEX GKWRNW-BLYD GKWRNW-BELB GKWRNW-BON">
<td class="GKWRNW-BKW GKWRNW-BIYD x-grid-cell-first explorerGridRow" style="" cellindex="0">
<td class="GKWRNW-BKW GKWRNW-BIYD undefined x-treegrid-column explorerGridRow" style="" cellindex="1">
<div class="GKWRNW-BMW GKWRNW-BJYD" style="">
<div id="x-auto-390" class="GKWRNW-BPLC">
<div class="GKWRNW-BMLC">
<img style="height: 18px; width: 0px;" src="data:image/gif;==">
<img class="GKWRNW-BOLC" style="width: 16px" src="data:image/gif;base64,R0l=="> <span class="GKWRNW-BILC"></span>
x-pathwill change too. - Razib