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

问题描述 投票:0回答:2

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

`@Test
public void LoginEmail() {

    driver.findElement(By.id("email_button")).sendKeys("[email protected]");`

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

无法复制选项,所以我拍了一个截图:

java selenium automation appium helper
2个回答
1
投票

你应该先初始化它:

 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();
  }

0
投票

AndroidDriver driver = new AndroidDriver(新URL(“localhost:4723 / wd / hub”),cap);这应该是类或本地可访问性。声明为类对象,即在此文本夹具或父类中,该类由本类继承或在本地初始化,即在测试方法中。

© www.soinside.com 2019 - 2024. All rights reserved.