selenium - 获取 org.openqa.selenium.ElementNotInteractableException 错误
问题描述
这是我在运行它时遇到的错误org.openqa.selenium.ElementNotInteractableException
。在这个程序中,我正在尝试使用DataProvider
注释测试具有 4 组不同数据的登录页面,因此我的脚本正在运行
- Chrome 启动
- 网站开放
- 点击并输入用户名和密码
上述三个步骤发生在所提供的每组数据上。但仍然在完成整个事情时,我收到了这个错误。请帮忙!
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import basePage.*;
//Login to edureka website
public class myPorfileupdate
{
WebDriver driver1;
@Test (dataProvider ="edulogin")
public void myLogin(String username, String password) throws IOException, InterruptedException
{ AppTest a =new AppTest();
driver1 = a.initializeDriver();
driver1.findElement(By.xpath("//span[@data-button-name='Login']")).click();
driver1.findElement(By.xpath("//input[@type='email']")).clear();
driver1.findElement(By.xpath("//input[@type='email']")).sendKeys(username);
driver1.findElement(By.xpath("//input[@type='password']")).sendKeys(password);
driver1.findElement(By.xpath("//*[@id=\"new_sign_up_optim\"]/div/div/div[2]/div[3]/form/button")).click();
Thread.sleep(1000);
driver1.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
try{
WebElement d= driver1.findElement(By.linkText("Trending Courses"));
System.out.println(d);
}
catch (Exception Ex){
// Get text displayes on login page
System.out.println("Userid/password is incorrect");
}
}
@DataProvider(name="edulogin")
public Object[][] testData() {
Object[][] data = new Object[4][2];
data[0][0] = "ambika97.singh@gmail.com";
data[0][1] = "Omsairam@1234";
//2nd row
data[1][0] = "abc";
data[1][1] = "Omsairam@1234";
//3rd row
data[2][0] = "ambika97.singh@gmail.com";
data[2][1] = "xyz";
//4th row
data[3][0] = "abc";
data[3][1] = "xyz";
return data;
}
}```
**First two lines of my console are**
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation.