- arifmActive particpant
- Posts : 12
Join date : 2012-08-08
Web driver not supporting xpath element ids
Mon Sep 10, 2012 10:55 pm
I converted an ide script to java/web driver. But in web driver code get element by x path not supported. Please reply asap.
- sreekumarActive particpant
- Posts : 16
Join date : 2011-12-27
Age : 39
Location : Hyderabad
Re: Web driver not supporting xpath element ids
Tue Sep 11, 2012 2:22 pm
Hi arifm
Could you write the script that you did in selenium IDE. I will change the code to that support to Web driver and Xpath...
Could you write the script that you did in selenium IDE. I will change the code to that support to Web driver and Xpath...
- arifmActive particpant
- Posts : 12
Join date : 2012-08-08
Re: Web driver not supporting xpath element ids
Tue Sep 11, 2012 3:44 pm
Sreekumar,
these are commands I used in IDE and Web driver.
In IDE it is working , but in web driver it is not working.
click //span[@id='slmTemplate']/div/div/table/tbody/tr/td- Command in IDE (x path- ID Relative)
driver.findElement(By.xpath("//span[@id='slmTemplate']/div/div/table/tbody/tr/td")).click(); Command in webdriver.
these are commands I used in IDE and Web driver.
In IDE it is working , but in web driver it is not working.
click //span[@id='slmTemplate']/div/div/table/tbody/tr/td- Command in IDE (x path- ID Relative)
driver.findElement(By.xpath("//span[@id='slmTemplate']/div/div/table/tbody/tr/td")).click(); Command in webdriver.
- pcoulson
- Posts : 2
Join date : 2012-09-12
Re: Web driver not supporting xpath element ids
Wed Sep 12, 2012 12:27 am
try this:
driver.findElement(By.id("//*[@id='slmTemplate']").click();
As the span has id, it is the best to use id instead of xpath.
driver.findElement(By.id("//*[@id='slmTemplate']").click();
As the span has id, it is the best to use id instead of xpath.
- arifmActive particpant
- Posts : 12
Join date : 2012-08-08
Web driver
Wed Sep 12, 2012 1:41 pm
pcoulson wrote:try this:
driver.findElement(By.id("//*[@id='slmTemplate']").click();
As the span has id, it is the best to use id instead of xpath.
I used this,It is not working. It is a javascript Application menu.Please suggest any other method
- sreekumarActive particpant
- Posts : 16
Join date : 2011-12-27
Age : 39
Location : Hyderabad
Re: Web driver not supporting xpath element ids
Wed Sep 12, 2012 2:58 pm
driver.findElement(By.xpath("//span[@id='slmTemplate']")).click();
I think so the above cmd should work
I think so the above cmd should work
Permissions in this forum:
You cannot reply to topics in this forum