Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
r2bhasin
Posts : 2
Join date : 2012-05-31

Just starting - Object identification help Empty Just starting - Object identification help

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"
else
puts "no"
end
_____________________________________________

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

Just starting - Object identification help Empty Re: Just starting - Object identification help

Sun Oct 21, 2012 6:09 pm
Hi,

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....
Back to top
Permissions in this forum:
You cannot reply to topics in this forum