2017-08-14 1 views
2
**Sinppet** 

if (os.contains("win")) { 
        System.out.println("OS: WINDOWS"); 
        System.setProperty("webdriver.chrome.driver", localPath+"chromedriver.exe"); 
        ChromeOptions chromeOptions = new ChromeOptions(); 
        chromeOptions.addArguments("headless"); 
        return new ChromeDriver(chromeOptions); 
       } else if (os.contains("mac")) { 
        System.out.println("OS: MAC");    
        System.setProperty("webdriver.chrome.driver", localPath+"chromedriver_mac64"); 
        return new ChromeDriver(); 
       } 

Erreur Je suis face àImpossible de lancer le navigateur sans tête Chrome dans Windows 7 en utilisant Sélénium

org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.xpath: //input[@id='user_id'] (tried for 180 second(s) with 500 MILLISECONDS interval) 
    at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:80) 
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232) 
    at com.adp.marketplace.frwk.selenium.SeleniumFunctions.waitForVisibilityByXpath(SeleniumFunctions.java:510) 
    at com.adp.marketplace.prm.SSOTestInPRMSteps.The_user_logged_into_PRM_with_valid_cred(SSOTestInPRMSteps.java:28) 
    at ?.Given the user logged into PRM with valid creds(com/adp/marketplace/prm/SSOTestsInPRM.feature:7) 

Répondre

1

L'argument pour sans tête est faux, devrait être:

chromeOptions.addArguments("--headless"); 

Avec - - avant sans tête, tout comme vous ajoutez des arguments à partir du raccourci: enter image description here