WebDriver启动常见的浏览器语句?
回复可见**** Hidden Message *****
public class google {
public static void main(String[] args) {
//谷歌浏览器需要加载驱动 chromedriver.exe
System.setProperty("webdriver.chrome.driver", "src/chromedriver.exe");
//创建一个chrome驱动打开谷歌浏览器
ChromeDriver driver = new ChromeDriver();
//访问百度
driver.get("https://www.baidu.com");
}
}
:handshake 呃,忘记了 from selenium import webdriver
driver = webdriver.Chrome() 直接加载吧
public class google {
public static void main(String[] args) {
//谷歌浏览器需要加载驱动 chromedriver.exe
System.setProperty("webdriver.chrome.driver", "src/chromedriver.exe");
//创建一个chrome驱动打开谷歌浏览器
ChromeDriver driver = new ChromeDriver();
//访问百度
driver.get("https://www.baidu.com");
}
}
页:
[1]