Selenium服务器等待chromedriver超时-但一切已开始

时间:2019-06-10 15:38:07

标签: selenium-webdriver centos selenium-chromedriver soapui headless

我尝试了chrome和driver的75、74和73版本。我尝试将服务器和语言绑定附带的所有硒罐添加到soapuis / bin / ext目录,然后将其删除。我已将server.jar文件设置为chown 7777(是的,我知道我知道!)。我已经安装了Xvfb,甚至是Xorg桌面...我也尝试了不同版本的Java,所有Java版本8

this

它调用的代码是

sh /home/venerable/SmartBear/SoapUI-5.5.0/bin/testrunner.sh -c 'tester2' -s 'Regression' "/home/venerable/projects/opengoogle" -t "/home/venerable/soapui-settings.xml" -f "/home/venerable/logs" -r -I

我得到的堆栈跟踪

import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.WebDriver

System.setProperty("webdriver.chrome.driver","/home/venerable/driver/chromedriver")
System.setProperty("webdriver.chrome.logfile","/home/venerable/driver/chromedriver.log")
log.info '############ creating proxy info ##########'
import org.openqa.selenium.Proxy
Proxy proxy = new Proxy()
proxy.setAutodetect(false)
proxy.httpProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.sslProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.socksUsername = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adUser" )
proxy.socksPassword = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adPass" )
log.info 'from system: User is '+proxy.socksUsername
log.info 'from system: '+ System.getProperty("webdriver.chrome.driver")
log.info proxy
ChromeOptions chromeOptions = new ChromeOptions()
chromeOptions.proxy = proxy
chromeOptions.addArguments("--headless")
chromeOptions.addArguments("--no-sandbox")
chromeOptions.addArguments("--disable-dev-shm-usage")
chromeOptions.addArguments("--disable-gpu")
chromeOptions.addArguments("--disable-features=NetworkService")
chromeOptions.addArguments("--window-size=1920x1080")
chromeOptions.setBinary("/usr/bin/google-chrome-stable")

log.info '################# starting driver #################'

WebDriver driver = new ChromeDriver(chromeOptions)

log.info '================ driver started ================'

driver.get("http://www.google.com")

log.info ":):):):):):):):):)closing driver:(:(:(:(:(:(:(:(:(:("

driver.close()
driver.quit()

return

我遵循了这些说明,我看到所有位都是单独运行的。事情是这段代码可以在我的Windows机器上正常工作 org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: 'unknown', revision: 'unknown'Selenium Chrome Browser org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start 这可能是一个已知问题吗? https://github.com/SeleniumHQ/selenium/issues/6160

1 个答案:

答案 0 :(得分:0)

添加下面的内容终于可以了

chromeOptions.addArguments("--headless")
chromeOptions.addArguments("--no-sandbox")
chromeOptions.addArguments("--disable-dev-shm-usage")
chromeOptions.addArguments("--disable-gpu")
chromeOptions.addArguments("--disable-features=NetworkService")
chromeOptions.addArguments("--window-size=1920x1080")
chromeOptions.addArguments("--disable-features=VizDisplayCompositor")

我现在也必须手动设置代理设置:

Proxy proxy = new Proxy()
proxy.setAutodetect(false)
proxy.httpProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.sslProxy = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("proxy")
proxy.socksUsername = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adUser" )
proxy.socksPassword = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "adPass" )