2016-04-01 8 views

答えて

1

あなたがテストを実行するための専用のマシンのための予算を持っていない場合は、簡単なトリックがオフスクリーンブラウザを起動することです:

ChromeOptions options = new ChromeOptions(); 
options.addArguments("--window-position=-32000,-32000"); 

WebDriver driver = new ChromeDriver(options); 
driver.get("http://stackoverflow.com"); 
0

はい、あなたが使用HtmlUnitDriverそれ以下のようにこれを行うことができますあなたのWebページには、ヘッドレスモードで開きがありません

https://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/htmlunit/HtmlUnitDriver.html 

visit http://stackoverflow.com/questions/12807689/selenium-vs-htmlunit

をご覧くださいHTMLユニットのドライバについての詳細は、任意のWebページのない可視性、すなわちんw質問に戻る

WebDriver driver = new HtmlUnitDriver(); 
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 
// do some action with html unit driver 
// for example open google home page 
driver.get("http://www.google.com"); 
// now verify that google home page is loaded properly 
System.out.println("Printing Title of the Google Home Page : " + driver.getTitle()); 

// above line prints on console : Printing Title of the Google Home Page : Google