2014-09-25 3 views
1

Я выполняю простую программу java и пытаюсь выполнить мой первый сценарий селена.получение исключения во время выполнения программы веб-драйвера selenium

public static void main(String[] args) { 
     // Create a new instance of the html unit driver 
     // Notice that the remainder of the code relies on the interface, 
     // not the implementation. 
     WebDriver driver = new HtmlUnitDriver(); 

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

эти зависимости, которые я добавил: dependencies that I have added

Но после выполнения этого кода я получаю это исключение в затмении.

java.lang.ClassNotFoundException: org.apache.xerces.xni.XNIException 
+0

Почему у вас есть xerces.jar, я не думаю, что это нужно для запуска сценария селена. Удалите это и попробуйте еще раз. –

ответ

0

ClassNotFoundException происходит в основном, когда файл класса не найден в указанном пути класса. Поэтому попробуйте удалить xerces.jar и добавить его снова.

+1

Я делал это раньше без xerces.jar, но это бросало исключение, о котором я упомянул. поэтому я добавил эту банку. теперь снова я удалил банку, но получаю такое же исключение. :( – rishi

Смежные вопросы