Question

The task is to check broken links on a webpage using selenium RC and java . It can be done simply by

a) click on link A
b) wait for page to open
c) focus on this window
d) verify text present on this page
e) Close this window

Then follow steps a to e for links B , links C .... links N

This process is sequential.

Is it possible to parallely open all links in new windows and verify whether they are broken or not i.e. a more professional way ?

Kindly Advice ( if possible with a sample of code )

Was it helpful?

Solution

Since a browser can realistically only click one link at a time, that's all you'll be able to do with Selenium. All it's doing is manipulating the browser as a user might.

If you're not concerned with AJAX at all, your better bet is probably to do this outside of Selenium with HTTPClient. There you could fetch the source and all links and issue a HEAD request to see if you get a 404 (no need to assert text is present). You could do this in parallel and not need to wait for the browser at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top