View previous topicGo downView next topic
Posts : 2
Join date : 2012-05-31

Just starting - Object identification help

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)??
rohit kumar gupta
Active particpant
Active particpant
Posts : 24
Join date : 2012-09-19
Age : 27
Location : abc

Re: Just starting - Object identification help

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....
View previous topicBack to topView next topic
Permissions in this forum:
You cannot reply to topics in this forum