Selenium Webdriver-> Gmail创建帐户-> Click事件在我的Gmail注册脚本中不起作用

时间:2018-09-06 11:31:55

标签: selenium selenium-webdriver

package Signin;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;

public class signin 
{
    public static void main(String[] args) throws Exception 
    {
        System.setProperty("webdriver.chrome.driver", "C:\\Users\\Teknomines-5\\Downloads\\Chromedriver.exe");
        WebDriver driver= new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("https://accounts.google.com/signup/v2/webcreateaccount?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F%3Fpc%3Dtopnav-about-en&flowName=GlifWebSignIn&flowEntry=SignUp");
        driver.findElement(By.id("firstName")).sendKeys("Dhruv");
        driver.findElement(By.id("lastName")).sendKeys("Sheth");
        driver.findElement(By.id("username")).sendKeys("shethdhruv0007");
        driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[1]/div[2]/form/div[2]/div/div[1]/div[3]/div[1]/div[1]/div/div/div[1]/div/div[1]/input")).sendKeys("dontdaretotry");
        driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[1]/div[2]/form/div[2]/div/div[1]/div[3]/div[1]/div[3]/div/div/div[1]/div/div[1]/input")).sendKeys("dontdaretotry");
        driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[1]/div[2]/form/div[2]/div/div[2]/div[1]/div/content/span")).click();  
        driver.manage().timeouts().implicitlyWait(5000,TimeUnit.SECONDS);
        // Thread.sleep(5000);
        driver.findElement(By.id("phoneNumberId")).sendKeys("8160703422");  
        driver.manage().timeouts().implicitlyWait(6000,TimeUnit.SECONDS);
        // driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div[1]/div[2]/form/div[2]/div/div[2]/div[1]/div/div[2]")).click();
        driver.findElement(By.xpath("//*[@id=\"gradsIdvPhoneNext\"]/div[2]")).click();
    }
}

所有脚本都能正常工作,但“下一页”下一个按钮不起作用(see video)。

0 个答案:

没有答案