Java程序中的“驱动程序无法解析”

我是编程世界的新手,所以我不知道如何解决这个问题。


`@Test

public void LoginEmail() {


    driver.findElement(By.id("email_button")).sendKeys("xxxxxxxx@gmail.com");`

在 driver.findElement 处,驱动程序带有红色下划线。当我将鼠标悬停在它上面时,这些是我的选择。


无法复制选项,所以我截取了屏幕截图:

http://img1.mukewang.com/62bd12310001e9fa06540648.jpg

饮歌长啸
浏览 199回答 2
2回答

撒科打诨

你应该先初始化它: 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();  }

鸿蒙传说

AndroidDriver driver = new AndroidDriver(new URL("localhost:4723/wd/hub"), cap); 这应该是类或本地可访问性。声明为类对象,即在此文本夹具中或在由该类继承的父类中或在本地初始化,即在测试方法中。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java