问题
I just installed OSX 10.9 on my mac and ever since then my Chromedriver is not working when I try to run tests.
The error I get is that "chrome was killed".
Everybody keeps mentioning that it works when you set Chromedriver to --verbose mode but I have no idea how to do that.
Any ideas?
回答1:
Here's a script that creates the executable you'll need, cd
to the directory where chromedriver is, then paste this into your console:
cat <<EOF>chromedriververbose
echo "running chromedriver --verbose \$*"
\$(dirname \$0)/chromedriver --verbose \$*
EOF
chmod +x chromedriververbose
That'll create an executable script called chromedriververbose
that you can point your tests at rather than chromedriver
.
Alternatively, you could rename chromedriver
to chromedriversilent
and then call the above script chromedriver
and point it to chromedriversilent
for drop-in replacement.
回答2:
To fix this issue, you can download the latest Chromedriver version 2.6 which resolves this issue.
Link - http://chromedriver.storage.googleapis.com/index.html
回答3:
I did the following from within the python console to test the verbose thing:
driver = webdriver.Chrome(service_args=["--verbose"])
It seemed to do the trick. Not ideal but it works for now.
回答4:
You can set command line flags in the capabilities (Java example)
capability = DesiredCapabilities.chrome();
capability.setCapability("chrome.switches",
Arrays.asList("--verbose"));
webDriver = new RemoteWebDriver(new URL(url), capability);
However I'm not seeing this actually solve the problem on my end, I still get
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: was killed
来源:https://stackoverflow.com/questions/19543444/how-to-start-chromedriver-in-verbose-mode-selenium-eclipse