0

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

eagin
  • 11
  • 3
  • I'm not a Windows expert, but on Linux it helps to start a dedicated X server and start the tests in there. Could you do something similar, for example using VNC or RDP? – C-Otto Aug 29 '16 at 08:47
  • Try out this. http://triflejs.org/ It uses PhantomJS underneath which is a famous headless browser (Phantom is supported by Selenium). I haven't tried it out though. – Abhirath Mahipal Aug 29 '16 at 11:05
  • Is there any documentation on how to use triflejs in selenium? – anandhu Feb 28 '20 at 12:17

2 Answers2

2

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"); 
iamsankalp89
  • 4,607
  • 2
  • 15
  • 36
1

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

Grasshopper
  • 8,908
  • 2
  • 17
  • 32