internet-explorer - 如何在远程机器上设置 IE webdriver

标签 internet-explorer webdriver installation selenium-webdriver

我所有的测试都在一个 ubuntu 盒子里运行。测试是用 PHP 编写的。它们可以与 Firefox 驱动程序和 chrome 驱动程序一起正常工作。我正在使用在同一个盒子中运行的独立 selenium 服务器(selenium-server-standalone-2.25.0.jar)。最近我需要针对 IE 平台编写测试。我已经尝试了一些事情,但到目前为止,我仍然不确定为我的特定场景设置 IE 驱动程序的正确方法是什么。

我尝试在同一个 ubuntu 框中安装带有 mono 的 IE,但在安装过程中遇到了很多问题,在我解决了这些问题并使其可以从命令行运行 IE 之后,它仍然没有为我的测试工作。

我在这里阅读了这个特定的文档:http://code.google.com/p/selenium/wiki/InternetExplorerDriver然后在一个窗口框上进行,直到我看到这个:

The HTTP server started by the IEDriverServer.exe sets an access control list to only accept connections from the local machine, and disallows incoming connections from remote machines. At present, this cannot be changed without modifying the source code to the IEDriverServer.exe. To run the Internet Explorer driver on a remote machine, use the Java standalone remote server in connection with your language binding's equivalent of RemoteWebDriver.



所以我将 selenium-server-standalone-2.25.0.jar 下载到 windows 机器并启动它;我的 IEDriverServer.exe 被放入了我的 PATH 中的 C:\windows\system32\。然后我将 ubuntu 框中的代码更改为指向在 windows 框上运行的 selenium 服务器。但仍然没有运气。

我用谷歌搜索了一下,有些人成功地让它运行起来了。但他们似乎正在使用 java 绑定(bind)或 c# 绑定(bind),我想他们是在本地机器上开发的。我还没有找到像我这样的工作案例:

a ubuntu box where PHP based tests run connection to a remote selenium server running on windows. a windows box with a selenium standalone server running and with IEDriverServer.exe in PATH



谢谢。

最佳答案

我有一个类似的问题 - 在 Linux 上工作并希望针对 IE 11 运行我的 WD 测试 - 并让它工作。我和 OP 的主要区别在于我的测试是用 Java 编写的。

我的目标是这样的:

  • 我的工作站:Ubuntu 14.04,用 Java 编写的测试。
  • Windows 机器:一些带有 IE 11 的虚拟机。
  • 我想针对在 Windows 机器上运行的 IE 运行测试,从 Ubuntu 工作站 (这样我就不需要在 Windows 机器上安装我的整个开发环境)。

  • 我做了什么:
  • 获得 Win 7 和 IE 11 VirtualBox VM,从 Microsoft (here) 下载,打开电源。
  • 下载到 Windows 框:(a) Java JRE,(b) Selenium Standalone Server jar(该页面上还没有提到“Internet Explorer 驱动程序服务器”),(c) Internet Explorer Driver .
  • 在我的工作站和 Windows 机器之间设置仅主机网络。 Here's一个很好的过程描述。尽管博文中的虚拟机是 Linux,但它对于 Windows 虚拟机的工作方式几乎相同(使用命令提示符下的“ipconfig”而不是“ifconfig”来查找您的 IP)。
  • 在 Windows 机器上,配置了官方 Internet Explorer 驱动程序页面中提到的内容,在 Required Configuration 部分中.如果他们更改链接,我将它们粘贴在这里:

    • The IEDriverServer executable must be downloaded and placed in your PATH.
    • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
    • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
    • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
    • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.


    注意我不需要把 IEDriverServer.exe的位置在 PATH 中,并且在我的 IE 11 设置中找不到“增强保护模式”(所以没有这样做)。
  • 在 Windows 机器上,从命令提示符开始(它们必须 两个 都在运行;我从 this issue 上的帖子中弄清楚了):
  • java -jar selenium-server-standalone-2.53.1.jar
  • IEDriverServer.exe
  • 编辑了我的测试的设置部分以使用 RemoteWebDriver ,就像这样(192.168.56.101 是 Windows 框的 Host Only 网络 IP):
    DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
    driver = new RemoteWebDriver(new URL("http://192.168.56.101:4444/wd/hub"),
        capability);
    
  • 像往常一样从我的 Ubuntu 工作站运行测试:mvn test myproject

  • 它奏效了! :)

    关于internet-explorer - 如何在远程机器上设置 IE webdriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12380454/

    相关文章:

    javascript - 切换窗口句柄并按 Enter

    C# Webdriver - 页面标题断言在页面加载前失败

    c++ - 从主目录执行时,在 Ubuntu 16.04 的 usr/local/bin 中安装的 C++ 应用程序无法正确运行

    css - 如何修复 jquery 数据表在 Internet Explorer 中溢出到父 div 之外?

    internet-explorer - IE : HTTPS security is compromised by res://ieframe. dll/sslnavcancel.htm

    java - Selenium 并不总是能够识别元素何时从 DOM 中删除

    python - 导入错误 : No module named tensorflow

    node.js - 使用node.js安装mongodb : Cannot read property 'arbiterOnly' of undefined

    javascript - Internet Explorer 中的 "Operation Aborted"错误是什么?

    python - 为什么程序总是打开http ://--port=57883/using IEDriverServer IE through Selenium Python