eagin
eagin

Reputation: 11

How can selenium run in IE do not show the browser windows?

The operating system is windows10, the programming language is JAVA ,the browser is IE11. How can selenium running without the browser windows?

Upvotes: 0

Views: 683

Answers (2)

iamsankalp89
iamsankalp89

Reputation: 4739

You can use phantonjs, HtmlUnitDriver or headless chrome

For HtmlUnitDriver

WebDriver driver=new HtmlUnitDriver();
driver.get("http://google.com"); 

For phantomjs first download ghostdriver and use

System.setProperty("phantomjs.binary.path", "E:\\phantomjs-2.1.1-windows\\phantomjs.exe");  
WebDriver driver = new PhantomJSDriver();   
driver.get("http://google.com");  

For chrome download the Chromedriver and use

System.setProperty("webdriver.chrome.driver","E:/software and tools/chromedriver_win32/chromedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("headless");
driver.get("http://google.com"); 

Upvotes: 2

Grasshopper
Grasshopper

Reputation: 9058

Use a headless browser like phantomjs, htmlunit to run with selenium webdriver.

Upvotes: 1

Related Questions