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

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

    <tfoot id='J6WJT'></tfoot>

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

        运行 selenium 远程驱动程序时出现带有 NativeConst

        时间:2023-09-28

        <tfoot id='Fc62D'></tfoot>

            <tbody id='Fc62D'></tbody>
              <bdo id='Fc62D'></bdo><ul id='Fc62D'></ul>

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

                <legend id='Fc62D'><style id='Fc62D'><dir id='Fc62D'><q id='Fc62D'></q></dir></style></legend>

                  <i id='Fc62D'><tr id='Fc62D'><dt id='Fc62D'><q id='Fc62D'><span id='Fc62D'><b id='Fc62D'><form id='Fc62D'><ins id='Fc62D'></ins><ul id='Fc62D'></ul><sub id='Fc62D'></sub></form><legend id='Fc62D'></legend><bdo id='Fc62D'><pre id='Fc62D'><center id='Fc62D'></center></pre></bdo></b><th id='Fc62D'></th></span></q></dt></tr></i><div id='Fc62D'><tfoot id='Fc62D'></tfoot><dl id='Fc62D'><fieldset id='Fc62D'></fieldset></dl></div>
                1. 本文介绍了运行 selenium 远程驱动程序时出现带有 NativeConstructorAccessorImpl.newInstance0 的错误 SessionNotCreatedException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在运行以下但收到错误

                  I am running the following but getting the error

                  public class base
                  {
                      public static WebDriver driver;
                  
                      public static void main(String[]  args) throws MalformedURLException, InterruptedException
                      {
                          System.setProperty("webdriver.chrome.driver", "C:\code\lib\browser drivers\chromedriver.exe");
                  
                          String URL = "http://www.google.com";
                          String Node = "http://localhost:4444/wd/hub";
                          DesiredCapabilities cap = DesiredCapabilities.chrome();
                          cap = DesiredCapabilities.chrome();
                          cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
                  
                  
                          driver = new RemoteWebDriver(new URL(Node), cap);
                  
                          driver.navigate().to(URL);
                          Thread.sleep(5000);
                          driver.quit();
                      }       
                  }
                  

                  错误显示如下:

                  Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
                  Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
                  System info: host: 'RAJESHW10', ip: '169.254.3.253', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
                  Driver info: driver.version: unknown
                  Command duration or timeout: 316 milliseconds
                      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                  

                  有人可以帮忙吗

                  推荐答案

                  请执行以下操作并重试.

                  Please do the following and retry.

                  确保将路径 C:\code\lib\browser drivers\chromedriver.exe 添加到计算机上的 %PATH% 变量中您正在运行的节点.这将确保 selenium uber jar 可以找到 chromedriver 二进制文件的位置.

                  Ensure that the path C:\code\lib\browser drivers\chromedriver.exe is added to your %PATH% variable on the machine in which you are running the node. This would ensure that the selenium uber jar can find the location of the chromedriver binary.

                  System.setProperty("webdriver.chrome.driver", "C:codelibrowser driverschromedriver.exe");

                  这个机制应该只在你做的时候使用

                  This mechanism should be only used when you are doing

                  ChromeDriver 驱动程序 = ChromeDriver()

                  由于您使用的是 selenium 网格,因此您在这里处理的是多个 JVM.

                  Since you are working with a selenium grid, you are dealing with multiple JVMs here.

                  System.setProperty() 只会影响当前的 JVM(在这种情况下是您的测试),但实际的浏览器会在不同的 JVM(运行 selenium 的那个节点).

                  System.setProperty() will affect only the current JVM (which in this case is your tests), but the actual browser gets spun off in a different JVM (the one that is running the selenium node).

                  这篇关于运行 selenium 远程驱动程序时出现带有 NativeConstructorAccessorImpl.newInstance0 的错误 SessionNotCreatedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 Selenium (Java) 在浏览器中禁用 JavaScript 下一篇:如何通过 selenium-webdriver 和 Java 使用 java 鼠标悬停

                  相关文章

                  最新文章

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

                  <tfoot id='3JJvJ'></tfoot>
                    <bdo id='3JJvJ'></bdo><ul id='3JJvJ'></ul>

                      <small id='3JJvJ'></small><noframes id='3JJvJ'>