org.openqa.selenium.os.OsProcess checkForError 和 org.apache.commons.exec.ExecuteException:进程因 Selenium ChromeDriver 错误而退出 [英] org.openqa.selenium.os.OsProcess checkForError and org.apache.commons.exec.ExecuteException: Process exited with an error with Selenium ChromeDriver

查看:46
本文介绍了org.openqa.selenium.os.OsProcess checkForError 和 org.apache.commons.exec.ExecuteException:进程因 Selenium ChromeDriver 错误而退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Linux 上以无头模式运行 soapui(在 Windows 上工作),但是在启动 webdriver 部分时,chrome 似乎没有看到驱动程序已启动.这甚至与 的操作系统不同OsProcess checkForError : CreateProcess error=193, %1 不是有效的 Win32 应用程序"通过 Java 和 Selenium 启动 Internet Explorer 时

I'm trying to run soapui in headless mode on linux (works from windows) but when initiating the webdriver portion it seems that chrome doesnt see the driver has started. This is not even the same OS as "OsProcess checkForError : CreateProcess error=193, %1 is not a valid Win32 application" while starting Internet Explorer through Java and Selenium

我已经尝试了 chrome 和驱动程序的 74 和 73 版.我尝试将服务器和语言绑定附带的所有 selenium jar 添加到soapuis /bin/ext 目录,然后将它们删除.我已将 server.jar 文件设置为 chown 7777(是的,我知道我知道!).我已经安装了 Xvfb,甚至是 Xorg 桌面...

i've tried version 74 and 73 of both chrome and driver. i've tried adding all the selenium jars that come with the server and language bindings to soapuis /bin/ext directory, and then removed them. I've set the server.jar file to chown 7777 (yeah i know i know!). I've installed Xvfb, even Xorg desktop...

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

还有 groovy 脚本:

and the groovy script:

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

System.setProperty("webdriver.chrome.driver","/home/venerable/driver/chromedriver")
System.setProperty("webdriver.chrome.logfile","/home/venerable/driver/chromedriver")

log.info 'from system: '+ System.getProperty("webdriver.chrome.driver")
ChromeOptions chromeOptions = new ChromeOptions()
chromeOptions.addArguments("--headless")
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

堆栈跟踪

18:30:58,176 INFO  [DefaultSoapUICore] initialized soapui-settings from [/home/venerable/soapui-settings.xml]
18:30:58,865 INFO  [PluginManager] 0 plugins loaded in 3 ms
18:30:58,865 INFO  [DefaultSoapUICore] All plugins loaded
18:31:00,576 INFO  [WsdlProject] Loaded project from [file:/home/venerable/projects/opengoogle]
18:31:00,587 INFO  [SoapUITestCaseRunner] Running SoapUI tests in project [tester]
18:31:00,588 INFO  [SoapUITestCaseRunner] Running TestCase [tester2]
18:31:00,597 INFO  [SoapUITestCaseRunner] Running SoapUI testcase [tester2]
18:31:00,597 INFO  [SoapUITestCaseRunner] running step [Groovy Script]
18:31:01,176 INFO  [log] from system: /home/venerable/driver/chromedriver
18:31:01,214 INFO  [log] ################# starting driver #################
Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on por
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to redirect stderr to log file.
Unable to initialize logging. Exiting...
May 27, 2019 6:31:21 PM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
18:31:21,470 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:53'
System info: host: 'ebu-venerable', ip: '10.33.134.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-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:53'
System info: host: 'ebu-venerable', ip: '10.33.134.55', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-el7.x86_64', java.version: '1.8.0_212'

我在这个耐心训练的最后,我确认所有单独的比特都在运行:Selenium Chrome 浏览器 org.openqa.selenium.WebDriverException: 等待驱动服务器启动超时我也关注了 https://gist.github.com/bugcy013/38287ec2adfc381cde7a8e7e9bdad6d7

i'm at the end of the patience train on this one, ive confirmed all the individual bits rae running: Selenium Chrome Browser org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start I have also followed https://gist.github.com/bugcy013/38287ec2adfc381cde7a8e7e9bdad6d7

推荐答案

根据您的代码试验,通过这一行:

As per your code trials though this line:

System.setProperty("webdriver.chrome.driver","/home/venerable/driver/chromedriver")

看起来很完美,但是下一行看起来容易出错,如下:

Looks to be perfect, but the next line looks error prone, which is as follows:

System.setProperty("webdriver.chrome.logfile","/home/venerable/driver/chromedriver")

Log 文件必须以 .log 的扩展名结尾.

Log files must end with extension of .log.

所以想必,你需要把这行代码改成:

So presumably, you need to change the line of code as:

System.setProperty("webdriver.chrome.logfile", "/home/venerable/driver/chromedriver.log");

这篇关于org.openqa.selenium.os.OsProcess checkForError 和 org.apache.commons.exec.ExecuteException:进程因 Selenium ChromeDriver 错误而退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆