Share
Go down
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 30
Location : Germany

text check

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

Re: text check

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

Re: text check

on 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
faramka
Professional
Professional
Posts : 143
Join date : 2011-09-15
Location : Poland

Re: text check

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

Re: text check

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

div previous idea close div

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

Re: text check

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

Re: text check

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

Re: text check

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

Re: text check

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

Re: text check

on 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

Re: text check

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