[英]Selenium webdriver C# automation script not working in edge browser
I have a selenium web driver C# script running successfully in IE browser.我有一个在 IE 浏览器中成功运行的 selenium web 驱动程序 C# 脚本。 But the same script is not working when I use the MS edge driver.但是当我使用 MS 边缘驱动程序时,相同的脚本不起作用。 I have ensured that the OS build number is same as the edge build as suggested here .我已确保操作系统内部版本号与此处建议的边缘版本号相同。 The script launches the URL but fails to find the element with the XPath provided.I am using the latest selenium version: 3.9.1.0 and Edge version:38.14393.2068.0 Please help.该脚本启动了 URL,但无法找到提供 XPath 的元素。我使用的是最新的 selenium 版本:3.9.1.0 和 Edge 版本:38.14393.2068.0 请帮忙。 Thanks.谢谢。
I have found that testing with Edge is a real pain because Selenium runs so fast.我发现使用 Edge 进行测试真的很痛苦,因为 Selenium 运行得非常快。 If the Element isn't found immeditaely then it fails (as it should because it doesn't see it).如果 Element 没有立即找到,那么它就会失败(因为它没有看到它,所以它应该失败)。 The only fix I have found is to add a Sleep time before commands that take longer.我发现的唯一解决方法是在需要更长时间的命令之前添加睡眠时间。 For example, if the webdriver is directed to a new url, it needs more time to load and find the element.例如,如果 webdriver 被定向到一个新的 url,它需要更多的时间来加载和查找元素。 This is a lot of trial and error, and some days it runs slower than others, but this may be what you need to do.这是大量的反复试验,有时它的运行速度比其他天慢,但这可能是您需要做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.