Forum Discussion
7 Replies
- tristaanogreEsteemed ContributorCouple of ways would be
a) Using an object check point where you store off a page with all the links and compare it to the real page.
b) doing a web page comparison to compare links.
Have you looked at these two items? - chicksRegular ContributorRobert,
Thanks very much for your response. I've reviewed the web accessibility, web comparison, and object checkpoint topics again.
As I understand it, "web accessibility" allows you to specify a set of standard "web page element" tests for a given web page.
Is this correct? The "check links" option appears ideal for me, except that our web pages are still being developed, so that I'm getting failures because some of the links are not defined yet.
As I understand it, "web comparison" allows you to test that the HTML of a page matches (at different levels - compare entire page, compare tag structure, compares specified tags ) the HTML of the stored object. This may work for me, I will have to experiment further.
Is this correct?
The object checkpoint lets me group objects and properties and run a single check or comparison, so as you suggest it would be a matter of selecting the parent object (presumably the entire web page) and checking the child objects (links) with their properties..... This also has possibilities.
Is there any way to automatically "crawl" all of the links within a specified website, so that I'm not manually navigating to each page?
Thanks again. Curt - Abramova
Staff
Hi,
As I understand it, "web accessibility" allows you to specify a set of standard "web page element" tests for a given web page. The "check links" option appears ideal for me, except that our web pages are still being developed, so that I'm getting failures because some of the links are not defined yet.
Is this correct?Yes, it is correct. You can use the Check link accessibility option of the Web Accessibility checkpoint to check whether all links on the page are available.
As I understand it, "web comparison" allows you to test that the HTML of a page matches (at different levels - compare entire page, compare tag structure, compares specified tags ) the HTML of the stored object. This may work for me, I will have to experiment further.
Is this correct?Yes, it is correct.
The object checkpoint lets me group objects and properties and run a single check or comparison, so as you suggest it would be a matter of selecting the parent object (presumably the entire web page) and checking the child objects (links) with their properties..... This also has possibilities.Yes, it is correct.
Is there any way to automatically "crawl" all of the links within a specified website, so that I'm not manually navigating to each page?You can record a test that will automatically navigate to the web site's pages and check the links accessibility on each page. That is, you need to perform verifications for each page.
- AlexKaras
Champion Level 2
Hi Curt,
Not out of the box, but these two links might help:
http://smartbear.com/support/viewarticle/9000/
http://smartbear.com/support/viewarticle/12701/ - chicksRegular Contributor
Hi Alex,
Very, very sweet ! So I can get a collection of all Links objects on the page (# 12701) , and then use the VerifyWebObject (#9000) to see if they're valid or not. Way cool.
Two quick questions, 1) the sample script for the VerifyWebObject does not pass the expectedWebObject parameter in the call. (Javascript) The method seems to be working fine without it however. What's happening there?
2) I got off into the Microsoft documentation for the Links collection and tried to find how to access the properties of the link object,
i.e. if the link == javascript:void(0) I'm not going to bother verifying it.
if ( Links != "javascript:void(0)" ) {
This actually works, but suppose I wanted to check on the innerText or namePropStr of the link. How can I access that? I tried using getAttribute but did not get it to work.
Thank you very much!
Curt - AlexKaras
Champion Level 2
Hi Curt,
> 1) the sample script for the VerifyWebObject does not pass the expectedWebObject parameter [...]
I'm not JScript expert, thus have only ideas: a) the empty (default) parameter initializes to the empty object of the corresponding type on the first use (which for the string is an empty string); and b) this is a typo in the code sample.
> [...] suppose I wanted to check on the innerText or namePropStr of the link.
Unchecked guess of top of my head would be to try something like
Links.innerText
To see the actual syntax I would recommend either to find the target object in the Object Browser or (during runtime) to stop the script on the breakpoint and Evaluate Links using Debug | Evaluate command and then press the Inspect button. Then select the relevant property in the grid on the right side and on the top of the window you will see the line of code that can be used in the script. - chicksRegular ContributorI had to pass the NativeWebObject property of the link gui object I found using FindChild...... and that worked for passing to the VerifyWebObject routine.
On the other hand getting from the Link object, I was able to use the InnerText so that worked as well.
Thanks very much.
Regards, Curt