Why my test is throwing Exception-Unable to locate element in webdriver?

前端 未结 5 1040
鱼传尺愫
鱼传尺愫 2021-01-24 06:41
package testproject;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.*;
          


        
5条回答
  •  耶瑟儿~
    2021-01-24 07:38

    //launch browser 
    FirefoxDriver driver = new FirefoxDriver(options); 
    driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
    //gmail login :
    driver.get("http://www.gmail.com");
    driver.findElement(By.id("identifierId")).sendKeys("****",Keys.ENTER);
    Thread.sleep(5000);
    driver.findElement(By.id("password")).sendKeys("***",Keys.ENTER);
    //logout:
    driver.findElement(By.xpath("//div[@id='gb']/div[1]/div[1]/div[2]/div[4]/div[1]/a/span")).click();
    Thread.sleep(5000);
    driver.findElement(By.linkText("Sign out")).click();
    

提交回复
热议问题