无法在google中使用selenium
键入密码public class FirtsTest extends WebDriverSettings {
@Test
public void firstTest() {
driver.get("https://www.google.com.ua/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
WebElement SignInButton = driver.findElement(By.id("gb_70"));
SignInButton.click();
WebElement Login = driver.findElement(By.id("identifierId"));
Login.clear();
Login.sendKeys("angelslayer1995");
WebElement NextButton = driver.findElement(By.id("identifierNext"));
NextButton.click();
WebElement PasswordInput = driver.findElement(By.cssSelector("input[type='password']"));
WebDriverWait wait = new WebDriverWait(driver,20);
wait.until(ExpectedConditions.elementToBeClickable(PasswordInput));
PasswordInput.clear();
PasswordInput.sendKeys("02091995");
}
}
答案 0 :(得分:0)
Google对每个定位器进行加密,以防止使用脚本进行自动输入。您不应尝试自动登录,您的IP将立即被列入黑名单。