开发者

checking broken links on a page parallely using selenium and java

开发者 https://www.devze.com 2023-01-14 12:17 出处:网络
The task is to check broken links on a webpage using selenium RC and j开发者_StackOverflow中文版ava . It can be done simply by

The task is to check broken links on a webpage using selenium RC and j开发者_StackOverflow中文版ava . 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 )


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号