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
cyssor
Posts : 5
Join date : 2012-06-15

Transversing through links, storing data and checking paths.  Empty Transversing through links, storing data and checking paths.

Thu Jun 21, 2012 9:03 pm
So I created some test scripts to check the links on multiple pages of my website using methods like:

open
/



clickAndWait
link=Advertising



clickAndWait
link=Advertising Home



clickAndWait
link=Advertising Products


--------------------------------------------------------

This method works perfectly fine as long as I have predetermined which links are to be recorded. This static link checking seems as if it would be a hassle to constantly update when new links are added to the page. I am trying to write a script that our QA personell can use every time we are about to release a new version of the website. Is there a way for selenium to transverse through a certain section of a webpage, store the links found and then check to see if they navigate correctly? Something along the lines of a loop that checks (for example) a navigation bar containing some number of links on the nav bar and then storing the paths of those links to be verified? Or the same scenario with footer links?

It seems like most tests that I've come across use the 'record' feature and clickAndWait with a predetermined link=SomeLinkPath.
avatar
cyssor
Posts : 5
Join date : 2012-06-15

Transversing through links, storing data and checking paths.  Empty Re: Transversing through links, storing data and checking paths.

Mon Jun 25, 2012 10:06 pm
Once again I have determined a solution and am posting my code for whoever else comes across this issue. The below test searches the # of links per Xpath in my footer div, stores the link count and then opens each link to check navigation issues.


open
/



storeXpathCount
id('ft')/x:div/x:div/x:div/x:div[2]/x:div[1]/x:ul[2]/x:li/x:a
count


storeExpression
1
index


while
${index} <= ${count}



storeAttribute
//div[@id=('ft')]/div/div/div/div[2]/div/ul[2]/li[${index}+1]/x:a@href
hrefToClick


echo
Checking Link: ${hrefToClick}



openAndWait
${hrefToClick}



pause
3000



goBackAndWait




storeEval
${index}+1
index


endWhile


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