我正在运行selenium for chrome并需要打开谷歌页面。我正在使用testng,我在路径\ src \ test \ resources中有我的chrome驱动程序。我使用jdk 1.8和Windows 64
我使用下面的代码,我无法成功加载
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("chromedriver-2.27.exe").getFile());
String path=file.getAbsolutePath();
System.setProperty("webdriver.chrome.driver",path);
WebDriver driver = new ChromeDriver();
driver.get("www.google.com");
我收到错误
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10 09:10:29 +0000'
System info: host: 'NANSARI', ip: '172.18.240.141', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver
请告知。
答案 0 :(得分:0)
以这种方式试试,看它是否有效 -
将ChromeDriver置于项目目录之外,例如 - C:\ Selenium_Drivers
代码 -
import numpy as np
import pandas as pd
import scipy
import numpy as np
from sklearn.preprocessing import normalize
x = np.random.rand(1000)*10
norm1 = x / np.linalg.norm(x)
norm2 = normalize(x[:,np.newaxis], axis=0).ravel()
print np.all(norm1 == norm2)
请使用最新版本的Selenium,ChromeDriver和Chrome