How to login into Salesforce (Chrome) application using selenium webdriver and avoid identity verification)

前端 未结 2 935
不知归路
不知归路 2021-01-27 06:59

I try login to Salesforce whit this script, but it launches the page of verification of identity. The user and password are working, so how can I avoid the verification page?

2条回答
  •  天涯浪人
    2021-01-27 07:37

    To login into the Salesforce Web Application as the AUT is based on Lazy Loading you have to induce WebDriverWait for the elements to be clickable as follows:

    driver.get("https://test.salesforce.com/");
    new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input.input.username#username"))).sendKeys("RodrigoC");
    driver.findElement(By.cssSelector("input.input.password#password")).sendKeys("RodrigoC");
    driver.findElement(By.cssSelector("input.button.wide.primary")).click();
    

提交回复
热议问题