Share
Go down
arifm
Active particpant
Active particpant
Posts : 12
Join date : 2012-08-08

Web driver not supporting xpath element ids

on 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.
sreekumar
Active particpant
Active particpant
Posts : 16
Join date : 2011-12-27
Age : 33
Location : Hyderabad

Re: Web driver not supporting xpath element ids

on 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...
arifm
Active particpant
Active particpant
Posts : 12
Join date : 2012-08-08

Re: Web driver not supporting xpath element ids

on 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.
pcoulson
Posts : 2
Join date : 2012-09-12

Re: Web driver not supporting xpath element ids

on 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.
arifm
Active particpant
Active particpant
Posts : 12
Join date : 2012-08-08

Web driver

on 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
sreekumar
Active particpant
Active particpant
Posts : 16
Join date : 2011-12-27
Age : 33
Location : Hyderabad

Re: Web driver not supporting xpath element ids

on Wed Sep 12, 2012 2:58 pm
driver.findElement(By.xpath("//span[@id='slmTemplate']")).click();

I think so the above cmd should work
Sponsored content

Re: Web driver not supporting xpath element ids

Back to top
Permissions in this forum:
You cannot reply to topics in this forum