• <tfoot id='3OhrD'></tfoot>

    1. <small id='3OhrD'></small><noframes id='3OhrD'>

      • <bdo id='3OhrD'></bdo><ul id='3OhrD'></ul>

      1. <legend id='3OhrD'><style id='3OhrD'><dir id='3OhrD'><q id='3OhrD'></q></dir></style></legend>
        <i id='3OhrD'><tr id='3OhrD'><dt id='3OhrD'><q id='3OhrD'><span id='3OhrD'><b id='3OhrD'><form id='3OhrD'><ins id='3OhrD'></ins><ul id='3OhrD'></ul><sub id='3OhrD'></sub></form><legend id='3OhrD'></legend><bdo id='3OhrD'><pre id='3OhrD'><center id='3OhrD'></center></pre></bdo></b><th id='3OhrD'></th></span></q></dt></tr></i><div id='3OhrD'><tfoot id='3OhrD'></tfoot><dl id='3OhrD'><fieldset id='3OhrD'></fieldset></dl></div>

        带有 Chrome 驱动程序的 Selenium 网格(WebDriverException:驱动程序可执行文件的路径必

        Selenium grid with Chrome driver (WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property)(带有 Chrome 驱动程序的 Selenium 网格(WebDriverException:驱动程序可执行文件的路径必须由 webdr
      2. <legend id='BzBsj'><style id='BzBsj'><dir id='BzBsj'><q id='BzBsj'></q></dir></style></legend>
      3. <small id='BzBsj'></small><noframes id='BzBsj'>

        <tfoot id='BzBsj'></tfoot>
        • <i id='BzBsj'><tr id='BzBsj'><dt id='BzBsj'><q id='BzBsj'><span id='BzBsj'><b id='BzBsj'><form id='BzBsj'><ins id='BzBsj'></ins><ul id='BzBsj'></ul><sub id='BzBsj'></sub></form><legend id='BzBsj'></legend><bdo id='BzBsj'><pre id='BzBsj'><center id='BzBsj'></center></pre></bdo></b><th id='BzBsj'></th></span></q></dt></tr></i><div id='BzBsj'><tfoot id='BzBsj'></tfoot><dl id='BzBsj'><fieldset id='BzBsj'></fieldset></dl></div>

                <tbody id='BzBsj'></tbody>

                  <bdo id='BzBsj'></bdo><ul id='BzBsj'></ul>
                  本文介绍了带有 Chrome 驱动程序的 Selenium 网格(WebDriverException:驱动程序可执行文件的路径必须由 webdriver.chrome.driver 系统属性设置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试让我的 Selenium Grid 在 Chrome 驱动程序上运行.

                  I am trying to get my Selenium Grid running on Chrome driver.

                  一开始我启动了集线器和节点:java -jar selenium-server-standalone-2.45.0.jar -role hubjava -jar selenium-server-standalone-2.45.0.jar -role node -hub http://localhost:4444/grid/register

                  At first I started hub and node: java -jar selenium-server-standalone-2.45.0.jar -role hub java -jar selenium-server-standalone-2.45.0.jar -role node -hub http://localhost:4444/grid/register

                  然后我开始我的测试:

                  public class ChromeDriverTest {
                      private WebDriver driver = null;
                      String  BaseURL,NodeURL;
                  
                  @Before
                  public void before() throws Exception{
                      BaseURL="http://www.google.com";
                      NodeURL="http://localhost:4444/wd/hub";
                      File file = new File("C:\Users\pushkaryova\Desktop\Nexus\driver\chromedriver.exe");
                      System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
                      DesiredCapabilities capa =DesiredCapabilities.chrome();
                      capa.setBrowserName("chrome");
                      capa.setPlatform(Platform.ANY);
                      driver=new RemoteWebDriver(new URL(NodeURL),capa);
                  }
                  
                  @Test
                  public void GoogleSearch() throws Exception {
                      driver.get("http://www.google.com");
                      WebElement searchBox = driver.findElement(By.xpath("//div[3]/div/input[1]"));
                      hightlight(searchBox);
                      driver.findElement(By.xpath("//div[3]/div/input[1]")).clear();
                      driver.findElement(By.xpath("//div[3]/div/input[1]")).sendKeys("Test");
                      driver.findElement(By.xpath("//button")).click();
                  
                  }
                  
                  public void hightlight(WebElement webElement) throws InterruptedException {
                      for (int i = 0; i < 2; i++) {
                          JavascriptExecutor js = (JavascriptExecutor) driver;
                          js.executeScript(
                                  "arguments[0].setAttribute('style', arguments[1]);",
                                  webElement, "color: red; border: 3px solid red;");
                      }
                  }
                  

                  }

                  并得到一个错误:org.openqa.selenium.WebDriverException:驱动程序可执行文件的路径必须由webdriver.chrome.driver系统属性设置

                  and get an error: org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property

                  我的代码有什么问题?

                  推荐答案

                  driver 可执行文件需要在节点机器上物理可用.您可以在启动node

                  The driver executable needs to be avaiable physically on node machine. You can set the path to exe while starting the node

                  在命令中添加这一行

                  -Dwebdriver.chrome.driver=./chromedriver.exe

                  我从 json 文件中配置了这个,发现这更容易

                  I configure this from json file and found that's little easier

                  名为 DefaultNode.json 的 json 文件

                  {
                    "capabilities":
                        [
                          {
                            "browserName": "firefox",
                            "maxInstances": 5,
                            "seleniumProtocol": "WebDriver"
                          },
                          {
                            "browserName": "chrome",
                            "maxInstances": 5,
                            "seleniumProtocol": "WebDriver"
                          },
                          {
                            "platform": "WINDOWS",
                            "browserName": "internet explorer",
                            "maxInstances": 1,
                            "seleniumProtocol": "WebDriver"
                          }
                        ],
                    "configuration":
                    {
                      "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
                      "maxSession": 5,
                      "port": 5555,
                      "host": ip,
                      "register": true,
                      "registerCycle": 5000,
                      "hubPort": 4444,
                      "hubHost": ip
                    }
                  }
                  

                  使用 json 配置启动节点

                  java -jar selenium-server-standalone-2.45.0.jar -role webdriver -nodeConfig DefaultNode.json -Dwebdriver.ie.driver=.IEDriverServer.exe
                  

                  注意 IEDriverServer.exejson 文件放在同一目录

                  Notice the IEDriverServer.exe is placed in same directory with json file

                  这篇关于带有 Chrome 驱动程序的 Selenium 网格(WebDriverException:驱动程序可执行文件的路径必须由 webdriver.chrome.driver 系统属性设置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                • <i id='tFDyg'><tr id='tFDyg'><dt id='tFDyg'><q id='tFDyg'><span id='tFDyg'><b id='tFDyg'><form id='tFDyg'><ins id='tFDyg'></ins><ul id='tFDyg'></ul><sub id='tFDyg'></sub></form><legend id='tFDyg'></legend><bdo id='tFDyg'><pre id='tFDyg'><center id='tFDyg'></center></pre></bdo></b><th id='tFDyg'></th></span></q></dt></tr></i><div id='tFDyg'><tfoot id='tFDyg'></tfoot><dl id='tFDyg'><fieldset id='tFDyg'></fieldset></dl></div>

                  <legend id='tFDyg'><style id='tFDyg'><dir id='tFDyg'><q id='tFDyg'></q></dir></style></legend>
                      • <bdo id='tFDyg'></bdo><ul id='tFDyg'></ul>

                          <small id='tFDyg'></small><noframes id='tFDyg'>

                              <tbody id='tFDyg'></tbody>
                            <tfoot id='tFDyg'></tfoot>