无法解决驱动程序

无法解决驱动程序

本文介绍了“无法解决驱动程序"在Java程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程界的新手,所以我不知道该如何解决.

I'm new to the programming world so I wouldn't know how to fix this.

`@Test
public void LoginEmail() {

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

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

At driver.findElement , driver is underlined red. When I hover over it these are my options.

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

Couldn't copy the options, so I took a screenshot:

推荐答案

您应该首先对其进行初始化:

you should initialize it first :

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

这篇关于“无法解决驱动程序"在Java程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 03:20