Java Selenium building xxx face Browser
1.http://phantomjs.org/
Download Windows version Phantomjs
2. exe file will be found in the bin directory after decompression
3. Test the code:
Copy Code
Package SE;
Import Org.openqa.selenium.WebDriver;
Import Org.openqa.selenium.firefox.FirefoxDriver;
Import Org.openqa.selenium.phantomjs.PhantomJSDriver;
public class Test {
public static void main(String[] args) { // TODO Auto-generated method stub// System.setProperty("webdriver.gecko.driver", "C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe"); System.setProperty("phantomjs.binary.path", "C:\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe");// WebDriver driver = new FirefoxDriver(); WebDriver driver = new PhantomJSDriver(); driver.get("http://www.baidu.com"); System.out.println(driver.getCurrentUrl());}
}
4.url Successful Printing
5.
Selenium PHANTOMJS javaxxx Surface Browser Environment construction