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

      <tfoot id='E4O5S'></tfoot>
      • <bdo id='E4O5S'></bdo><ul id='E4O5S'></ul>
      1. <legend id='E4O5S'><style id='E4O5S'><dir id='E4O5S'><q id='E4O5S'></q></dir></style></legend>
      2. <small id='E4O5S'></small><noframes id='E4O5S'>

        如何解决"org.openqa.selenium.WebDriverException: jav

        时间:2023-09-28

        • <bdo id='S8HMD'></bdo><ul id='S8HMD'></ul>
            • <small id='S8HMD'></small><noframes id='S8HMD'>

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

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

                  <tfoot id='S8HMD'></tfoot>
                  本文介绍了如何解决"org.openqa.selenium.WebDriverException: java.net.ConnectException: 无法连接到 localhost/"用谷歌驱动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我从 1 周开始就面临上述问题.早些时候它工作顺利.即使现在有时它也可以正常工作,但大多数时候我都会收到无法连接到 localhost/"错误.:(我已将 chrome 驱动程序升级到 2.37,现在又将其降级到 2.36,但没有运气.:( 谢谢.

                  I am facing above mentioned issue since 1 week. Earlier it was working smoothly. Even now sometimes it works fine but most of the time I am getting "Failed to connect to localhost/" error. :( I have upgraded chrome driver to 2.37 now downgraded it again to 2.36 but no luck. :( Thanks.

                  问题详情:java.net.ConnectException: 无法连接到 localhost/0:0:0:0:0:0:0:1:4321构建信息:版本:'3.11.0',修订:'e59cfb3',时间:'2018-03-11T20:33:15.31Z'系统信息:主机:'GURWUNknjk',ip:'10.202.126.154',os.name:'Windows 8.1',os.arch:'amd64',os.version:'6.3',java.version:'1.8.0_131'驱动信息:driver.version:RemoteWebDriver

                  以下代码供您参考:注意:在登录之前它工作正常.只有当我在登录后尝试搜索某些元素时才会出现问题.

                  Here is code for your reference: Note : It works fine till login. Issue comes only when I try to search some element after login.

                      public static WebDriver driver;
                      public static void main(String[] args) throws InterruptedException, IOException {
                                  System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe");
                          driver = new ChromeDriver();
                          String url = "https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Faccounts.google.com%2Fb%2F0%2FAddMailService&flowName=GlifWebSignIn&flowEntry=AddSession";
                          driver.get(url);
                  
                  driver.manage().window().maximize();
                          WebDriverWait wait = new WebDriverWait(driver, 20);
                          driver.manage().timeouts().implicitlyWait(15,TimeUnit.SECONDS) ;
                  
                          wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input[type='Email']")));
                  
                          if(driver.getCurrentUrl().contains("https://accounts.google.com/signin/v2/identifier?"))
                          {
                  
                              driver.findElement(By.id("identifierId")).sendKeys(username);
                              driver.findElement(By.id("identifierNext")).click();        wait.until(ExpectedConditions.presenceOfElementLocated(By.name("password"))); 
                              driver.findElement(By.name("password")).sendKeys(pwd);
                              driver.findElement(By.name("password")).sendKeys(Keys.ENTER);
                          }
                          else{
                              wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input[type='Email']")));
                              driver.findElement(By.name("Email")).sendKeys(UserName);
                              driver.findElement(By.id("next")).click();           wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Passwd")));
                              driver.findElement(By.name("Passwd")).sendKeys(Pwd);
                                      wait.until(ExpectedConditions.presenceOfElementLocated(By.name("signIn")));
                   driver.findElement(By.id("signIn")).click();
                             }
                  wait.until(ExpectedConditions
                                      .visibilityOfElementLocated(By.id(element id)));
                              driver.findElement(By.id(element id))
                              .sendKeys(some value);
                              Thread.sleep(3000);
                              driver.findElement(By.id(element id)).click(); }
                  

                  推荐答案

                  错误说明了一切:

                  java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:4321 
                  Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z' 
                  System info: host: 'GURWUNknjk', ip: '10.202.126.154', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_131' 
                  Driver info: driver.version: RemoteWebDriver
                  

                  错误清楚地表明 ChromeDriver 未被识别为:

                  The error clearly shows that the ChromeDriver was not recognized as in :

                  Driver info: driver.version: RemoteWebDriver
                  

                  您的主要问题是您使用的二进制文件之间的版本兼容性,如下所示:

                  Your main issue is the version compatibility between the binaries you are using as follows :

                  • 您正在使用 chromedriver=2.37
                  • 我们不知道您的 chrome 版本.
                  • 您的 Selenium 客户端 版本是 3.11.0.
                  • 您的 JDK 版本1.8.0_131,相当古老.
                  • You are using chromedriver=2.37
                  • Your chrome version is unknown to us.
                  • Your Selenium Client version is 3.11.0.
                  • Your JDK version is 1.8.0_131 which is pretty ancient.

                  所以 JDK v8u131Selenium Client v3.11.0ChromeDriver 版本之间存在明显的不匹配(v2.37).

                  So there is a clear mismatch between the JDK v8u131 , Selenium Client v3.11.0 , ChromeDriver version (v2.37).

                  • JDK 升级到最新级别 JDK 8u162.
                  • ChromeDriver 保留在当前 ChromeDriverv2.37 级别.
                  • Chrome 版本保持在 Chrome v65.x 级别.(根据 ChromeDriver v2.37 发行说明)
                  • 清理你的项目工作区通过你的IDE重建你的项目只需要依赖.
                  • 使用 CCleaner 工具清除之前和在您的测试套件执行之后.
                  • 如果您的基础 Web Client 版本太旧,请通过 卸载它Revo Uninstaller 并安装最新的 GA 和发布版本的 Web Client.
                  • 进行一次系统重启.
                  • 执行你的 @Test.
                  • Upgrade JDK to recent levels JDK 8u162.
                  • Keep ChromeDriver at current ChromeDriver v2.37 level.
                  • Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.37 release notes)
                  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
                  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
                  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
                  • Take a System Reboot.
                  • Execute your @Test.

                  这篇关于如何解决"org.openqa.selenium.WebDriverException: java.net.ConnectException: 无法连接到 localhost/"用谷歌驱动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何修复 [1573451709.039][警告]:连接到 Chrome 时超时 下一篇:SessionNotCreatedException:会话未创建:此版本的 Chrom

                  相关文章

                  最新文章

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

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

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

                      <bdo id='rCtA2'></bdo><ul id='rCtA2'></ul>
                    <tfoot id='rCtA2'></tfoot>