我尝试注销时超时异常

时间:2017-02-25 14:57:48

标签: java selenium-webdriver explicit

我必须登录yahoomail然后我必须撰写邮件然后我必须注销。 能够登录,撰写但无法注销。请在下面找到相同的代码。 我需要通过明确的等待来做到这一点。

    WebDriverWait wait = new WebDriverWait(driver,30);
    driver.findElement(By.id("login-username")).sendKeys("****");
    driver.findElement(By.id("login-signin")).click();
//  WebElement password=driver.findElement(By.id("login-passwd"));

    WebElement element=wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("login-passwd")));
    element.sendKeys("*****");
    driver.findElement(By.id("login-signin")).click();
    String text=element.getText();

    WebDriverWait wait1=new WebDriverWait(driver, 20);
    WebElement element4=wait1.until(ExpectedConditions.visibilityOfElementLocated(By.id("yucs-mail_link_id")));
    element4.click();

    WebDriverWait wait2=new WebDriverWait(driver, 60);

    WebElement element3=wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@class='btn btn-compose']")));
    driver.findElement(By.xpath("//*[@class='btn btn-compose']")).click();
    //element3.click();


    WebDriverWait wait3=new WebDriverWait(driver, 300);
    WebElement element5=wait3.until(ExpectedConditions.visibilityOfElementLocated(By.id("to-field")));
    element5.sendKeys("****");
    driver.findElement(By.id("subject-field")).sendKeys("Test mail");
    driver.findElement(By.id("rtetext")).sendKeys("Hi ,congrates");
    driver.findElement(By.linkText("Send")).click(); //("yui_3_16_0_ym19_1_1487880655873_2622")).click();

    Actions builder=new Actions(driver);
    WebElement logout=driver.findElement(By.xpath("//li[@id='yucs-profile']/a/i")); //yui_3_16_0_2_1487938370596_76 //.//*[@id='yui_3_10_3_1_1375219693637_127']
    builder.clickAndHold(logout).click().build().perform();     


    WebDriverWait wait4=new WebDriverWait(driver, 30);
    WebElement element9=wait4.until(ExpectedConditions.visibilityOfElementLocated(By.id("yucs-signout")));
    element9.click();

0 个答案:

没有答案