user2353303
user2353303

Reputation: 11

Troubles in running Selenium

I wrote a simple program in eclipse, when I run it shows the following error. I have already add selenium package to my project

my program in eclipse:

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

public class Gmail {

    /**
     * @param args
     */
    public static void main(String[] args) {    
        WebDriver wd1 = new FirefoxDriver();
        wd1.get("www.gmail.com");
    }
}

the results:

Exception in thread "main"

org.openqa.selenium.WebDriverException: Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]
Command duration or timeout: 14 milliseconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-40-generic-pae', java.version: '1.7.0_21'
Session ID: 6c6bc33a-3296-4b06-b74d-53919dc5d6c9
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=LINUX, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=20.0}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
    at Gmail.main(Gmail.java:13)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '3.2.0-40-generic-pae', java.version: '1.7.0_21'
Driver info: driver.version: unknown

Upvotes: 1

Views: 1499

Answers (1)

Yi Zeng
Yi Zeng

Reputation: 32885

You need to add http:// in your url.

public class Gmail {

    public static void main(String[] args) {
        WebDriver wd1 = new FirefoxDriver();
        wd1.get("http://www.gmail.com");
    }
}

Upvotes: 4

Related Questions