- cyssor
- Posts : 5
Join date : 2012-06-15
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.
--------------------------------------------------------
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.
- cyssor
- Posts : 5
Join date : 2012-06-15
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
- Selenium IDE showing error In google page couldnt test the links and verifyTextpresent when we click on some links
- urgent- please give me one example of data driven data program in selenium rc using java language
- Problems using dynamic paths in Selenium IDE
- Grabbing the current URL and storing it as a string.
- Storing and Printing Post Element
Permissions in this forum:
You cannot reply to topics in this forum