OS X で chrome を使用してセレン テストを実行しようとしています。firefox では問題なく動作しますが、chrome ドライバーがブラウザーと通信していないようです。
これが私のコードです:
import junit.framework.TestCase;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class DriverTest extends TestCase {
public void testFirefox(){
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
driver.close();
}
public void testChrome(){
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
driver.close();
}
}
実行すると、Firefox は正常に起動しますが、Chrome では次のエラーが発生します。
Started ChromeDriver
port=45421
version=23.0.1240.0
log=/Users/user/projects/client/hg/chromedriver.log
objc[25753]: Object 0x6e078170 of class NSPathStore2 autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[25753]: Object 0x6e078360 of class NSPathStore2 autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[25753]: Object 0x6e078410 of class NSConcreteData autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[25753]: Object 0x6e078470 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
objc[25753]: Object 0x6e0782c0 of class NSBundle autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.7.4', java.version: '1.6.0_35'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:493)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:182)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:165)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:107)
at DriverTest.testChrome(DriverTest.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
Caused by: org.openqa.selenium.WebDriverException: Unable to convert: {desiredCapabilities=Capabilities [{platform=ANY, browserName=chrome, chromeOptions=org.openqa.selenium.chrome.ChromeOptions@448be1c9, chrome.switches=[], version=}]}
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 22:18:01'