简体   繁体   English

网页测试自动化框架中的问题

[英]Issues in automation framework for web page testing

Currently I am in process of building an automation tool for testing webpages. 目前,我正在构建一个用于测试网页的自动化工具。 Already aware of selenium tool but will not be using that currently as our framework has already been built and requires minor changes to make it reliable. 已经知道了selenium工具,但目前还没有使用它,因为我们的框架已经构建完成,需要进行细微的修改才能使其可靠。 While testing this framework with test pages (html and javascript only) I encounter issues such as webpage takes a lot if time to load(happens like 1 out of 20 times). 在使用测试页面(仅限html和javascript)测试此框架时,如果加载时间(如20次中的1次),我会遇到诸如网页等问题。 And when you try to find the co-ordinate and click the button or try to find the element in the webpage and click it sometimes it fails as button doesn't even exists at that point of time. 当你试图找到坐标并单击按钮或尝试在网页中找到该元素并单击它时,它有时会失败,因为在那个时间点甚至不存在按钮。

Currently using Thread.sleep or retry n number of times. 目前使用Thread.sleep或重试n次。 Are there any better solutions to remove this flaky behavior? 有没有更好的解决方案来消除这种片状行为?

look into WebDriverWait class. 查看WebDriverWait类。 There is a respective binding for c# as well. c#也有相应的绑定。 Also, I have discussed the WebDriverWait here . 另外,我在这里讨论了WebDriverWait。

You can try to use Implicit waits Read about it here http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp 您可以尝试使用隐式等待在此处阅读http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Basically you set it once per session. 基本上你每次会话都设置一次。 If you can't find an element, selenium waits the amount of time you set before throwing the exception. 如果找不到元素,selenium将等待您在抛出异常之前设置的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM