问题:selenium运行时提示“ Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms” 【selenium为selenium-2.41.0】
解决:分析为“http://stackoverflow.com/questions/12588082/webdriver-unable-to-connect-to-host-127-0-0-1-on-port-7055-after-45000-ms” You need to check the browser compatibility before opting to test with Selenium:
http://selenium.googlecode.com/git/java/CHANGELOG
This might help to answer the above question.
http://selenium.googlecode.com/git/java/CHANGELOG
This might help to answer the above question.
检查了自己本地的firefox版本为32.0,而changlong中写的是“ v2.41.0 ======= WebDriver: * Update to support native events for Firefox 28 (removed native event support for Firefox 26). Native events are now supported for the following Firefox versions:”
找了新的firefox26.0 add了执行路径(http://jarvi.iteye.com/blog/1447672)
//打开指定路径的firefox,方法1
System.setProperty("webdriver.firefox.bin","D:\\Program Files\\Mozilla Firefox\\firefox.exe");
WebDriver dr = new FirefoxDriver();
System.setProperty("webdriver.firefox.bin","D:\\Program Files\\Mozilla Firefox\\firefox.exe");
WebDriver dr = new FirefoxDriver();
[测试通过]
- //打开指定路径的firefox,方法2
- File pathToFirefoxBinary = new File("D:\\Program Files\\Mozilla Firefox\\firefox.exe");
- FirefoxBinary firefoxbin = new FirefoxBinary(pathToFirefoxBinary);
- WebDriver driver1 = new FirefoxDriver(firefoxbin,null);
ok了
没有评论:
发表评论