Java Selenium build no interface 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:
Packagese;ImportOrg.openqa.selenium.WebDriver;ImportOrg.openqa.selenium.firefox.FirefoxDriver;ImportOrg.openqa.selenium.phantomjs.PhantomJSDriver; Public classTest { Public Static voidMain (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 =NewPhantomjsdriver (); Driver.get ("Http://www.baidu.com"); System.out.println (Driver.getcurrenturl ()); }}
4.url Successful Printing
Selenium phantomjs Java No interface browser environment construction