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
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty text check

Fri Jan 20, 2012 8:12 pm
Is there a way to check the position of a specific text ?
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

text check Empty Re: text check

Fri Jan 20, 2012 9:07 pm
If you know which element contains the text, you can use getElementPositionLeft() and getElementPositionTop().
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 9:25 pm
Ok thanks I will try it now.
What I am trying to do is:
I have a list of ideas and i can sort them by "most recent" "most liked" and "last modified". And i need to test if those options work properly.
So what I was thinking is for example to post a new idea and then arrange ideas by "most recent" and check if that idea is on the top of the list.

If anyone have a better idea fell free to share it Smile
avatar
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

text check Empty Re: text check

Fri Jan 20, 2012 9:40 pm
Is "idea is on the top of the list"equal to "idea is at the first place of the list"?

Can you check html source of the page?
If it looks like this:
(after arranging ideas by "most recent")
Code:
< u l id="ideas">
    <li>Recent Idea</li>
    <li>An Idea</li>
    <li>Other Idea</li>
</ u l>
you can simply get the text of first element li and check if it is equals to posted idea.
Command | getText
Target | //ul[@id='ideas']/li[1]


Last edited by faramka on Fri Jan 20, 2012 9:42 pm; edited 1 time in total
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 9:49 pm
it looks like this
div latest idea close div

div previous idea close div

....
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 9:54 pm
Is "idea is on the top of the list"equal to "idea is at the first place of the list"?

The last idea in the database table should be the first one in the most recent view
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 10:04 pm
or maybe i have to login to mysql database, find the last idea, store its title in a variable and then check if the title is equal to the title on the first position in my ideas list ?
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 10:20 pm
I figured it out thanks for the help
my top idea always have this path:
//*[@id='content-container']/div[1]/div[5]/div[1]/div[3]/a
no matter which one is on the top of the list
my second always have this path no matter which one is on second place
//*[@id='content-container']/div[1]/div[5]/div[2]/div[3]/a
and so on so that makes it easy to check everything
thanks again have a nice weekend
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 10:29 pm
oh one more ting Very Happy im such a noob in selenium ide Wink
now im doing this:
1.I submit a new idea with the name "testing IdeaPool most recent"
2. command: storeText
target: //*[@id='content-container']/div[1]/div[5]/div[1]/div[3]/a
value: topidea
3. and then echo ${topidea} prints the idea on the top of my list
and now i need to compare topidea and "testing IdeaPool most recent"
how can i do that in selenium ide ? what command do i use ? or i have to make my own function for that ?
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 35
Location : Germany

text check Empty Re: text check

Fri Jan 20, 2012 11:28 pm
I DID IT !!! Very Happy (happy) you can close the topic

first i store the title of the idea while i enter new idea
storeValue name=title lastidea
echo ${lastidea} --> get me the name of the last idea
then i go to most recent ideas and store the title of the idea thats on position 1
storeText //*[@id='content-container']/div[1]/div[5]/div[1]/div[3]/a topidea
${topidea} gives me the name of the top idea
then i do this
store javascript{var bool=(storedVars['lastidea']===storedVars['topidea']);bool;} bool
echo ${bool} gives me true if the names are the same and false if they are not Smile
thats it Smile
Sponsored content

text check Empty Re: text check

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