Best way to automate a page and check if it is loaded correctly

梦想的初衷 提交于 2019-12-09 03:50:55

问题


I am looking to verify if this page loads correctly - http://www2.hm.com/en_ca/women.html

These are the things I think it would be best to verify if the page is loaded correctly, please let me know if I am missing anything

1) Verify all the links on this page works?

2) Verify if the menu on the top is loaded correctly, Do I need to verify the menu names?

3) Check if the classes are loaded properly?

4) get/post request status 200 and other ajax calls?


回答1:


As per your question a seperate test to check if the page is loaded correctly will be a complete overhead because the Client (i.e. the Web Browser) will never return the Execution Control back to the WebDriver instance until and unless 'document.readyState' is equal to "complete". Once this condition is fulfilled Selenium performs the next line of code.

You can find a detailed discussion on this topic in Selenium IE WebDriver only works while debugging

Next as you want to Verify if all the links on this page works or not , you can write a function() and invoke the function() whereever required.

Moving on to next question, there is no necessity to Verify if the menu on the top is loaded correctly or not as you can't test each and every aspect of each and every WebElement present on a WebPage. The best approach would be to verify and validate the attributes of only those elements with whom we need to interact.

Again Checking if the classes are loaded properly will be a overhead as JVM takes care of it in the best possible way.

Finally, to validate get/post request status 200 you have to write Tests as per your requirement.



来源:https://stackoverflow.com/questions/48737103/best-way-to-automate-a-page-and-check-if-it-is-loaded-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!