[英]org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start while initiating Chrome browser through Selenium
I am unable to enter the URL in the chrome browser as currently the browser is getting opened but the URL is not getting entered automatically. 我无法在Chrome浏览器中输入URL,因为当前正在打开浏览器,但未自动输入URL。 Their is some issue of browser probably.
他们可能是浏览器的某个问题。
The code is: 代码是:
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
public class OpenBidAssist {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
System.out.println("TEST1");
WebDriver driver=new ChromeDriver();
WebDriverWait wait=new WebDriverWait(driver, 20);
System.out.println("TEST2");
driver.get("https://stg-cipher-fe.ofbusiness.in/");
System.out.println("TEST3");
}
}
The Error i am getting is: 我得到的错误是:
TEST1
Created new window in existing browser session.
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'ofbl219-Latitude-3480', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-49-generic', java.version: '1.8.0_181'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at OpenBidAssist.main(OpenBidAssist.java:13)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:11320/status] to be available after 20006 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
... 9 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 10 more
Can anyone help me in it. 谁能帮助我。 Thanks in advance,
提前致谢,
replace System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
替换
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
with the path of exe file like System.setProperty("webdriver.chrome.driver", "your path of Driver/chromedriver.exe");
带有诸如
System.setProperty("webdriver.chrome.driver", "your path of Driver/chromedriver.exe");
类的exe文件System.setProperty("webdriver.chrome.driver", "your path of Driver/chromedriver.exe");
This error message... 此错误消息...
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
...implies that your program was unable to initiate/spawn a new WebDriver ie ChromeDriver process. ...表示您的程序无法启动/产生新的WebDriver,即ChromeDriver进程。
Your main issue is the Value you have passed to the System.setProperty()
line. 您的主要问题是传递给
System.setProperty()
行的Value 。
Instead of the absolute path of the Google Chrome client binary, you need to pass the absolute path of the ChromeDriver . 您需要传递ChromeDriver的绝对路径,而不是Google Chrome客户端二进制文件的绝对路径。 So you need to:
因此,您需要:
Change: 更改:
"/usr/bin/google-chrome"
With: 附:
"/path/to/chromedriver"
Essentially, you need to: 本质上,您需要:
Change: 更改:
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");
With: 附:
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
Note : You can download the relevant version of ChromeDriver from ChromeDriver - WebDriver for Chrome 注意 :您可以从ChromeDriver-WebDriver for Chrome下载相关版本的ChromeDriver
It is very clear from your code that you are trying to create ChromeDriver but the path to the executable is not correct. 从代码中可以很明显地看出,您正在尝试创建ChromeDriver,但是可执行文件的路径不正确。
Download the latest ChromeDriver executable from the chromedriver downloads 从chromedriver下载中下载最新的ChromeDriver可执行文件
Then replace the 然后更换
System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome"); System.setProperty(“ webdriver.chrome.driver”,“ / usr / bin / google-chrome”);
with 同
System.setProperty("webdriver.chrome.driver", "/path to chromedriver/chromedriver.exe"); System.setProperty(“ webdriver.chrome.driver”,“ /chromedriver/chromedriver.exe的路径”);
We spent an extraordinary amount of time figuring out why we got this exact error on the build servers but not on the developer stations. 我们花费了大量的时间来弄清楚为什么在构建服务器上却没有在开发人员工作站上得到这个确切的错误。 You can get this error when Chrome is not installed.
未安装Chrome时会出现此错误。 The path to the ChromeDriver.exe can be perfect but you will still get this error if you don't also have Chrome.
ChromeDriver.exe的路径可以是完美的,但是如果您还没有Chrome,则仍然会出现此错误。 When you run ChromeDriver.exe manually it will start up and be responsive without Chrome installed, you can query it at http://localhost:9515/status but it still won't work under test.
当您手动运行ChromeDriver.exe时,它将在未安装Chrome的情况下启动并响应,您可以在http:// localhost:9515 / status上对其进行查询,但仍无法在测试中运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.