selenium - 如何在同一节点的不同浏览器版本中运行selenium代码?

标签 selenium selenium-webdriver selenium-grid

我正在尝试对节点中存在的不同版本的浏览器可执行文件运行一个测试。我如何在代码中传递版本信息以及如何配置节点以接受这些争论?

最佳答案

要在同一节点上运行不同的浏览器版本,您需要按照以下步骤操作。

Install all the required browser versions on the node machine in case of Firefox browser and in case of ChromeDriver or IEDriver Keep different binary versions.

现在您需要在评论 NodeConfig 中提到的 node_config 文件中提及所有浏览器版本.

例如:- 您可以在 node_config 文件中提及不同的浏览器版本,如下所述,我使用了 2 个不同的 Firefox 版本。

{
      "browserName": "firefox",
      "maxInstances": 3,
      "version": 40,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "firefox",
      "maxInstances": 3,
      "version":38, 
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "chrome",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    }
}

现在您可以使用相同的配置启动节点,并且您将能够在 Selenium Grid 控制台上看到 2 个不同的浏览器版本。

Selenium Grid Console

一旦您能够设置节点,您就可以在网格中心上运行代码,它将负责浏览器分发。

关于selenium - 如何在同一节点的不同浏览器版本中运行selenium代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34390790/

相关文章:

python - Selenium Grid2 - 是否可以运行 10 个 Chrome 实例?

Selenium GRID——调用 WebDriver.getCurrentUrl() 时, session 由于 TIMEOUT 在不到 100 毫秒后终止

selenium - 运行 selenium 独立服务器和集线器/节点设置有什么区别

c# - 将鼠标悬停在元素上以显示并单击隐藏元素

java - 使用数组作为测试方法的参数

google-app-engine - 托管 VM 添加到 PATH

java - Java中的Selenium找不到ahref

java - 如何检查 URL 中的搜索关键字

xml - 如何在没有testng.xml文件的情况下执行Testng和Maven

selenium-webdriver - org.openqa.selenium.ElementNotVisibleException : Cannot click on element"in WebDriver(IE9)