Я сохранил веб-драйвер в /home/iyo/webdriver. Мой код:
package com.googlecode.webdriver.example;
import com .googlecode.webdriver.By;
импорт com.googlecode.webdriver.WebDriver;
импорт com.googlecode.webdriver.WebElement;
импорт com.googlecode.webdriver.htmlunit.HtmlUnitDriver;
public class FirstTest {
public static void main(String[] args) {
драйвер WebDriver = new HtmlUnitDriver ();
driver.get("http://www.google.com");
элемент WebElement =
driver.findElement(By.xpath("//input[@) name = 'q']"));
element.sendKeys("Сыр!");
element.submit();
System.out.println("Заголовок страницы: " + driver.getTitle());
}
}
Но я с javac -cp /home/iyo/webdriver FirstTest.java Я получил такие ошибки: FirstTest.java:5: невозможно найти символ
символ: класс. Автор
местоположение: пакет com.googlecode.webdriver
импорт com.googlecode.webdriver.By ;
Код: Выделить всё
^
символ: класс WebDriver
расположение: пакет com.googlecode.webdriver
импорт com.googlecode.webdriver.WebDriver;
Код: Выделить всё
^
символ: класс WebElement
расположение: пакет com.googlecode.webdriver
импорт com.googlecode.webdriver.WebElement;
Код: Выделить всё
^
import com. googlecode.webdriver.htmlunit.HtmlUnitDriver;
Код: Выделить всё
^
символ: класс WebDriver
Расположение: класс com.googlecode.webdriver.example.FirstTest
Код: Выделить всё
WebDriver driver = new HtmlUnitDriver();
^
символ: класс HtmlUnitDriver
Расположение: класс com.googlecode.webdriver.example.FirstTest
Код: Выделить всё
WebDriver driver = new HtmlUnitDriver();
^
символ: класс WebElement
Расположение: класс com.googlecode.webdriver.example.FirstTest
Код: Выделить всё
WebElement element =
^
символ: переменная Автор:
Расположение: класс com.googlecode.webdriver.example.FirstTest
Код: Выделить всё
driver.findElement(By.xpath("//input[@name = 'q']"));
^
Это
Код: Выделить всё
s possible to use it whitouht Ant?(The code in NetBeans or Eclipse work well, but I don
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/722 ... and-line-w