Session2 error

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Session2 error

txm062
Hi when running the test in session 2
package com.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class WebDriverTest {

        public static void main(String[] args) {

                WebDriver driver= new FirefoxDriver();
                driver.get("http://www.wikipedia.org/");
                driver.findElement(By.id("searchInput")).sendKeys("selenium software");
                driver.findElement(By.name("go")).click();
                driver.findElement(By.cssSelector(".mw-search-results li:nth-of-type(1) a")).click();
        }

}

I get the error, any help would be greatly appreciated.

Exception in thread "main" org.openqa.selenium.WebDriverException: java.io.FileNotFoundException: C:\Users\Admin\workspace\Session (The system cannot find the file specified)
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'Compaq-02', ip: '192.168.1.118', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_51'
Driver info: driver.version: FirefoxDriver
        at org.openqa.selenium.firefox.FirefoxProfile.onlyOverrideThisIfYouKnowWhatYouAreDoing(FirefoxProfile.java:131)
        at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:86)
        at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:79)
        at org.openqa.selenium.firefox.FirefoxProfile.<init>(FirefoxProfile.java:67)
        at org.openqa.selenium.firefox.FirefoxDriver.getProfile(FirefoxDriver.java:266)
        at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:243)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:197)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:190)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
        at com.selenium.WebDriverTest.main(WebDriverTest.java:11)
Caused by: java.io.FileNotFoundException: C:\Users\Admin\workspace\Session (The system cannot find the file specified)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at sun.net.www.protocol.jar.URLJarFile.<init>(Unknown Source)
        at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
        at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
        at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.jar.JarURLConnection.getInputStream(Unknown Source)
        at java.net.URL.openStream(Unknown Source)
        at org.openqa.selenium.firefox.FirefoxProfile.onlyOverrideThisIfYouKnowWhatYouAreDoing(FirefoxProfile.java:129)
        ... 11 more


Reply | Threaded
Open this post in threaded view
|

Re: Session2 error

Anonym
I have the same problem -.- Does anyone have a solution? It seems to me that the problem is with the driver.findElement(By.name("go")).click();
Reply | Threaded
Open this post in threaded view
|

Re: Session2 error

Sarat
In reply to this post by txm062
I suggest to use Xpath instead of button.

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class forumqa {

    public static void main(String[] args) {

        WebDriver driver= new FirefoxDriver();
        driver.get("http://www.wikipedia.org/");
        driver.findElement(By.id("searchInput")).sendKeys("selenium software");
        driver.findElement(By.xpath("/html/body/div[2]/form/fieldset/button")).click();

        //driver.close();
        //driver.quit();
    }