Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用其他场景练习时,Selenium Xpath click不起作用_Java_Eclipse_Selenium Webdriver_Automated Tests - Fatal编程技术网

Java 使用其他场景练习时,Selenium Xpath click不起作用

Java 使用其他场景练习时,Selenium Xpath click不起作用,java,eclipse,selenium-webdriver,automated-tests,Java,Eclipse,Selenium Webdriver,Automated Tests,这是我代码的一部分。当我分别运行这两个时,它运行时没有任何错误。但当我尝试同时以优先级运行这两个时,它显示错误,如下所示 已通过:重置\u psw 失败:重置\u电子邮件 org.openqa.selenium.TimeoutException:预期条件失败: 正在等待位于by.xpath的元素的可见性: //*[@id='app']/div/div[2]/form/div[3]/div[2]/button[contains(text(),'Send 密码重置链接“)]”(尝试了60秒,持续50

这是我代码的一部分。当我分别运行这两个时,它运行时没有任何错误。但当我尝试同时以优先级运行这两个时,它显示错误,如下所示

已通过:重置\u psw

失败:重置\u电子邮件

org.openqa.selenium.TimeoutException:预期条件失败: 正在等待位于by.xpath的元素的可见性: //*[@id='app']/div/div[2]/form/div[3]/div[2]/button[contains(text(),'Send 密码重置链接“)]”(尝试了60秒,持续500毫秒 间隔时间)

登录页面显示60秒,无需点击我想要的链接

如何解决这个错误?
请帮助我找到此问题…

我尝试使用元素存在时可能出现重复,但它也不起作用。然后我尝试按照代码进行操作,等待.until(ExpectedConditions.visibilityOfElementLocated(By.linkText(“Tehingud”));WebElement ele=wait.until(ExpectedConditions.elementtobelickable(By.linkText(“Tehingud”));睡眠(1000);ele.click();这也不起作用。请帮我找到解决方案…提前谢谢
//@Test(priority=8)
public void reset_psw()
{
    LoginPage login=new LoginPage(driver);
    driver.findElement(By.xpath("//*[@id='app']/div/div[2]/a")).click();        
    WebDriverWait wait = new WebDriverWait(driver, 10);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='app']/div/div[2]/form/div[3]/div[2]/button[contains(text(),'Send Password Reset Link')]")));
    String expectedTitle = "Placer Admin - Password recovery";
    String actualTitle = driver.getTitle();
    login.equal_titles(actualTitle, expectedTitle);
    driver.navigate().refresh();
}

@Test(priority=9)
public void reset_email()
{
    LoginPage login=new LoginPage(driver);
    driver.findElement(By.xpath("//*[@id='app']/div/div[2]/a")).click();
    WebDriverWait wait = new WebDriverWait(driver, 60);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='app']/div/div[2]/form/div[3]/div[2]/button[contains(text(),'Send Password Reset Link')]")));
    /*login.set_reset_email("");
    login.click_reset_button(); 
    WebDriverWait wait_reset_psw = new WebDriverWait(driver, 10);
    wait_reset_psw.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='app']/div/div[2]/form/div[2]/span[2]")));
    Assert.assertEquals(driver.findElement(By.xpath("//*[@id='app']/div/div[2]/form/div[2]/span[2]")).getText(),"The email field is required.");*/
    driver.navigate().refresh();
}       
@AfterTest
public void close()
{
    driver.close();
}