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

问题描述 投票:1回答:1

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

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

我得到的堆栈跟踪

    ================================
    =
    = SOAPUI_HOME = /home/venerable/SmartBear/SoapUI-5.5.0
    = JAVA = /home/venerable/SmartBear/SoapUI-5.5.0/jre/bin/java
    =
    ================================
    2019-06-10 18:35:29,621 [main] WARN  com.eviware.soapui.SoapUI - Could not find jfxrt.jar. Internal browser will be disabled.
    SoapUI 5.5.0 TestCase Runner
####stack was too long so its been ommitted, this is where it counts tho
    18:35:33,693 INFO  [PluginManager] 5 plugins loaded in 2346 ms
    18:35:33,693 INFO  [DefaultSoapUICore] All plugins loaded
    18:35:34,851 INFO  [WsdlProject] Loaded project from [file:/home/venerable/projects/opengoogle]
    18:35:34,861 INFO  [SoapUITestCaseRunner] Running SoapUI tests in project [tester]
    18:35:34,861 INFO  [SoapUITestCaseRunner] Running TestCase [tester2]
    18:35:34,866 INFO  [SoapUITestCaseRunner] Running SoapUI testcase [tester2]
    18:35:34,866 INFO  [SoapUITestCaseRunner] running step [Groovy Script]
    18:35:35,184 INFO  [log] from system: /home/venerable/driver/chromedriver
    18:35:35,202 INFO  [log] ################# starting driver #################
    Starting ChromeDriver 75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40}) on port 14279
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
    18:35:55,406 ERROR [SoapUI] An error occurred [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: 'ebu-venerable', ip: '10.33.134.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.2.el7.x86_64', java.version: '1.8.0_212'
    Driver info: driver.version: ChromeDriver], see error log for details
    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: 'ebu-venerable', ip: '10.33.134.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.12.2.el7.x86_64', java.version: '1.8.0_212'
    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:157)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
            at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
            at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
            at Script1.run(Script1.groovy:16)
            at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:90)
            at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)
            at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:211)
            at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:47)
            at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:138)
            at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:46)
            at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:128)
            at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:76)
            at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:594)
            at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:573)
            at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:405)
            at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:202)
            at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:137)
            at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:112)
            at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:122)
    Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:14279/status] to be available after 20002 ms
            at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
            at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
            ... 33 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)
            ... 34 more
    18:35:55,416 ERROR [SoapUITestCaseRunner] Groovy Script failed, exporting to [/home/venerable/logs/Regression-tester2-Groovy_Script-0-FAILED.txt]
    18:35:55,426 INFO  [SoapUITestCaseRunner] Finished running SoapUI testcase [tester2], time taken: 20542ms, status: FAILED
    18:35:55,427 INFO  [SoapUITestCaseRunner] TestCase [tester2] finished with status [FAILED] in 20542ms

我遵循了这些说明,我看到所有位都是单独运行的。事情是这段代码可以在我的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

selenium-webdriver centos selenium-chromedriver soapui headless
1个回答
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" )
© www.soinside.com 2019 - 2024. All rights reserved.