Display results as :

Rechercher Advanced Search


Just starting - Object identification help

View previous topic View next topic Go down

Just starting - Object identification help

Post by r2bhasin on Mon Oct 15, 2012 4:27 pm

Hi guys,
I've just written my first Sel Webdriver script in ruby and am trying to run it, it doesn't seem to be recognizing the object i need to verify.
I've copied the xpath of the object i need to verify from Firebug and written the code below -
myn = driver.find_element(:xpath, "/html/body/div/div[2]/div/section/div/div/header/div/h1")

if myn == "Welcome to myn" then
puts "yes"
puts "no"

I would expect it to print yes but it prints no, so i think it is not recognising the object correctly. I suspect i'm not using it correctly maybe, please help??
Also, is it possible to verify that a certain xpath or CSS will identify the object without running the script(like in QTP we have Highlight object in application in the OR)??


Posts : 2
Join date : 2012-05-31

Back to top Go down

Re: Just starting - Object identification help

Post by rohit kumar gupta on Sun Oct 21, 2012 6:09 pm


In order to identify, Find button of selenium ide can be a workaround.

Second thing findelement will return you the handle of the object and you are trying to compare it to a string.
** to resolve this you can try this
int i=myn.getText().compareto("what you expect");
if i=0 then it matches....

rohit kumar gupta
Active particpant
Active particpant

Posts : 24
Join date : 2012-09-19
Age : 26
Location : abc

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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