为了账号安全,请及时绑定邮箱和手机立即绑定

在Java中使用Selenium WebDriver登录Gmail

在Java中使用Selenium WebDriver登录Gmail

冉冉说 2019-10-04 15:32:52
import java.util.concurrent.TimeUnit;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;import org.openqa.selenium.firefox.FirefoxDriver;import org.openqa.selenium.support.ui.ExpectedConditions;import org.openqa.selenium.support.ui.WebDriverWait;public class NewGmail {    public static void main(String[] args) {            WebDriver driver = new FirefoxDriver();            driver.manage().window().maximize();            String url = "https://accounts.google.com/signin";            driver.get(url);            driver.findElement(By.id("identifierId")).sendKeys("cp8805");             //driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);                  WebDriverWait wait=new WebDriverWait(driver, 20);                           driver.findElement(By.xpath("//span[@class='RveJvd snByac']")).click();                     driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);                    driver.findElement(By.xpath("//input[@class='whsOnd zHQkBf']")).sendKeys("xxxxxx");                         driver.findElement(By.xpath("//span[@class='RveJvd snByac']")).click();     }  }邮件ID后,我的密码也会写在ID框选项中,并且服务器重定向到下一个密码页面。我想问一下我该怎么做,以便仅在密码页面中输入我的密码。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 392 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信