java - Java程序中的“驱动程序无法解析”
问题描述
我是编程世界的新手,所以我不知道如何解决这个问题。
`@Test
public void LoginEmail() {
driver.findElement(By.id("email_button")).sendKeys("xxxxxxxx@gmail.com");`
在 driver.findElement 处,驱动程序带有红色下划线。当我将鼠标悬停在它上面时,这些是我的选择。
无法复制选项,所以我截取了屏幕截图:
解决方案
你应该先初始化它:
try {
WebDriver driver = new AndroidDriver();
// And now use this to visit Google
driver.get("http://www.google.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
} catch (Exception e) {
e.printStackTrace();
}
推荐阅读
- python - 使用 Scrapy 高效循环数据
- android - AAPT:android 集成第三方库时出错
- laravel - Laravel 6 pathinfo() 期望参数 1 是字符串,给定对象
- ckeditor - CKEditor 5 - 允许特定属性
- javascript - 如何连接javascript数组
- django - 表格无效
- javascript - 我需要在我的网页中为电梯图像设置动画并将其移动到视图中的预设位置
- javascript - JavaScript 数组 - 删除重复项并只返回一个
- python - 删除相关定义线周围的线
- java - 如何使用变量访问 getStringArray