Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 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"
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)??

r2bhasin

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

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....

rohit kumar gupta
Active particpant
Active particpant

Posts : 24
Join date : 2012-09-19
Age : 27
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