远程桌面、Selenium 和 SendKeys:WebDriver 服务器在 60 秒后超时 [英] Remote Desktop, Selenium and SendKeys: WebDriver server timed out after 60 seconds

查看:54
本文介绍了远程桌面、Selenium 和 SendKeys:WebDriver 服务器在 60 秒后超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Selenium 测试,当它作为 Jenkins 作业的一部分在 vSphere 中托管并通过 RDP 管理的节点上运行时会失败.测试在IE11下运行.

I have a Selenium test which would fail when run as part of a Jenkins job on a node hosted in vSphere and administered through RDP. The test are run with IE11.

经过一些故障排除后,如果远程桌面已连接并聚焦,它会成功,但如果远程桌面断开连接甚至最小化,则会失败并出现异常:

After some troubleshooting it turned out it succeeds if Remote Desktop is connected and focused but fails with an exception if Remote Desktop is disconnected or even minimized:

OneTimeSetUp: OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:56095/session/817b36df-a1b5-484e-b205-d4a0bac8002a/element/0cfa6678-2104-4bc6-bb71-e6d8eac507fb/value timed out after 60 seconds.
  ----> System.Net.WebException : The operation has timed out

失败的行:

textboxElement.SendKeys("foo").Perform();

作为一种解决方法,我通过 vSphere 控制台而不是 RDP 登录,然后即使在关闭 vSphere 之后,测试也不再失败.这是一种解决方法,但我必须小心,永远不要通过 RDP 登录,而始终仅通过 vSphere 控制台进行管理.

As a workaround, I logged through vSphere Console instead of RDP and then even after closing vSphere the test didn't fail anymore. This is a workaround but I would have to be careful never to login through RDP and always to administer only through vSphere Console.

所以我的问题是:

  • SendKeys() 是否与 RDP 会话不兼容,是否相关 这个 winapi 错误?
  • 在 Selenium 中是否有使用 SendKeys() 的替代方法?
  • Is SendKeys() somehow incompatible with an RDP session and is it related to this winapi bug?
  • Is there an alternative to using SendKeys() in Selenium?

推荐答案

找到了罪魁祸首 - InternetExplorerOptions 中有一个标志 RequireWindowFocus = true 导致了问题.删除它后,我不再收到错误.这可能与 https://github.com/seleniumhq 有关/selenium-google-code-issue-archive/issues/5431.

Found the culprit - there was a flag RequireWindowFocus = true in InternetExplorerOptions which was causing the issue. After removing it I no longer get the error. This might be related to https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/5431.

这篇关于远程桌面、Selenium 和 SendKeys:WebDriver 服务器在 60 秒后超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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