公共类AutoEmail {
公共静态void main(String [] args)抛出InterruptedException,FileNotFoundException,IOException,ParseException {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\try\\Documents\\NetBeansProjects\\AutoEmail\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.setExperimentalOption("useAutomationExtension", false);
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
WebDriver driver = new ChromeDriver(options);
driver.get("https://accounts.google.com/ServiceLogin?");
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@id='identifierId']"))).sendKeys("email@gmail.com");
driver.findElement(By.id("identifierNext")).click();
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='password']"))).sendKeys("password");
driver.findElement(By.id("passwordNext")).click();
}
}
答案 0 :(得分:3)
来自support.google.com的引用:
为保护您的帐户,Google不允许您使用某些浏览器登录。 Google可能会停止从以下浏览器登录: