自动化页面并检查它是否正确加载的最佳方法 [英] Best way to automate a page and check if it is loaded correctly

查看:21
本文介绍了自动化页面并检查它是否正确加载的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望验证此页面是否正确加载 - http://www2.hm.com/en_ca/women.html

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) 验证此页面上的所有链接是否有效?

1) Verify all the links on this page works?

2) 验证顶部的菜单是否加载正确,是否需要验证菜单名称?

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

3) 检查类是否加载正确?

3) Check if the classes are loaded properly?

4) 获取/发布请求状态 200 和其他 ajax 调用?

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

推荐答案

根据您的问题,检查页面是否正确加载的单独测试将是一个完整的开销 因为 Client(即 Web 浏览器)永远不会将 Execution Control 返回给 WebDriver 实例,直到并且除非 'document.readyState' 等于完成".一旦满足这个条件,Selenium 就会执行下一行代码.

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.

您可以在 Selenium IE WebDriver 仅在调试时工作

接下来要验证此页面上的所有链接是否有效,您可以编写一个 function() 并调用 function() 任何需要的地方.

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.

继续下一个问题,没有必要验证顶部的菜单是否正确加载,因为您无法测试每个方面的每个方面WebPage 上的 WebElement.最好的方法是仅验证和验证我们需要与之交互的那些元素的属性.

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.

再次检查类是否正确加载将是一个开销,因为 JVM 会以最好的方式处理它.

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

最后,要验证 get/post 请求状态 200,您必须根据您的要求编写 Tests.

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

这篇关于自动化页面并检查它是否正确加载的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆