Перейти к содержимому

Фотография

Netbeans Java


  • Авторизуйтесь для ответа в теме
В этой теме нет ответов

#1 moozee

moozee

    Новый участник

  • Members
  • Pip
  • 58 сообщений
  • ФИО:Хомяк Виктор

Отправлено 24 апреля 2012 - 07:33

Вчера столкнулся с непонятной ошибкой, устранить которую не получилось. До определенного момента все написанные тесты работали вполне нормально. Использую для запуска и написания - Netbeans. Однако же, после запуска теста внезапно вылетела ошибка.. ссылающаяся отнюдь не на ошибки в коде.. есть у кого мнения насчет этого?
код ошибки :
run:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Maps
	at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:56)
	at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:79)
	at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:67)
	at javaapplication6.JavaApplication6.main(JavaApplication6.java:32)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	... 4 more
Java Result: 1

код теста:

package javaapplication6;
import com.thoughtworks.selenium.Selenium;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.OutputStreamWriter;
import java.io.FileOutputStream;
import java.io.UnsupportedEncodingException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.Calendar;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import java.awt.Toolkit;
import java.io.IOException;
import java.net.Proxy;
import java.util.NoSuchElementException;
import javax.annotation.Resource;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import org.openqa.selenium.Alert;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class JavaApplication6 {
    //private static WebDriverBackedSelenium selenium;
    
    public static void main(String[] args) throws InterruptedException, UnsupportedEncodingException, FileNotFoundException {
        
        FirefoxProfile profile = new FirefoxProfile();
             
        WebDriver driver = new FirefoxDriver(profile);
              
        driver.get("http://www.swagbucks.com/");
        driver.manage().deleteAllCookies();
        PrintWriter writer1 = new PrintWriter(new OutputStreamWriter(new FileOutputStream("C:\\reports_SB.txt", true), "UTF-8"));
        String Dt;
        String Dt1;
        Dt = java.util.Calendar.getInstance().getTime().toString();
        writer1.println("\n \n");
        writer1.println("************************************************ \n ************************************************");
        writer1.println("The SB_reg_less13 test has been started at "+Dt+" !");
        writer1.println("\n \n");
        // Find the text input element by its id
            while(true) {
                WebElement fname = driver.findElement(By.id("fName"));
                if (fname.isDisplayed()==true){
                    fname.sendKeys("child");
                    writer1.println("First Name has been successfully entered.");
                    }break;
            }
       WebElement lName = driver.findElement(By.id("lName"));
       lName.sendKeys("child");
       writer1.println("Last Name has been successfully entered.");
       WebElement passw = driver.findElement(By.id("passw"));
       passw.sendKeys("ggggggggggggg");
       writer1.println("New Password has been successfully entered.");
       WebElement cpassw = driver.findElement(By.id("cpassw"));
       cpassw.sendKeys("ggggggggggggg");
       writer1.println("The Password has been successfully confirmed.");
       WebElement swagName = driver.findElement(By.id("swagName"));
       swagName.click();
       writer1.println("The cursor has been succesfully moved on the field swagName");
       Toolkit.getDefaultToolkit().beep();
       Toolkit.getDefaultToolkit().beep();
            while(true) {
                WebElement zipTxt = driver.findElement(By.id("zipTxt"));
                if (zipTxt.isDisplayed()==true){
                    zipTxt.sendKeys("55416");
                    writer1.println("Email and swagname have been succesfully entered.");
                    writer1.println("Zip code has been succesfully entered.");
                    break;}
       }
     Select selectBox =new Select(driver.findElement(By.id("monthSelect")));
     selectBox.selectByValue("3");
     Select selectBox1 = new Select(driver.findElement(By.id("daySelect")));
     selectBox1.selectByValue("3");
     Select selectBox2 = new Select(driver.findElement(By.id("yearSelect")));
     selectBox2.selectByValue("2007");
     Select selectBox3 = new Select(driver.findElement(By.id("genderSelect")));
     selectBox3.selectByValue("Male");
     Select selectBox4 = new Select(driver.findElement(By.id("sqQuestion")));
     selectBox4.selectByValue("22");
     writer1.println("Date of birth less than 13 y.o., Gender, and Secret Question has been successfully selected");
     WebElement sqAnswer = driver.findElement(By.id("sqAnswer"));
     sqAnswer.sendKeys("TN");
     writer1.println("The Security Answer has been succesfully entered.");
     WebElement agreeCheck = driver.findElement(By.id("agreeCheck"));
     agreeCheck.click();
     Toolkit.getDefaultToolkit().beep();
     Thread.sleep(2000);
     while(true) {
         try{
                   WebElement fldBtm = driver.findElement(By.id("fldBtm"));
                if (fldBtm.isDisplayed()==true){
                    writer1.println("New User hasn't been registered.");
                    break;
                }        
         }
         catch(Exception e){
             writer1.println(e.toString());
         continue;
         }
                     
       }
            
     Dt1 = java.util.Calendar.getInstance().getTime().toString();
     writer1.println("\n \n");
     writer1.println("The SB_reg_less13 test has been finished at "+Dt1+" !");
     writer1.println("************************************************ \n ************************************************");
     writer1.close();
     driver.close();
    }
}

  • 0


Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных