0

I had written a small piece of code opening a website on Firefox using Selenium WebDriver.It opens the browser window but doesn't navigate to given URL & a blank page is displayed instead for a while.
Code :-

WebDriver wd = new FirefoxDriver();
            System.setProperty("webdriver.firefox.bin","C:\\Program Files\\MozillaFirefox\\Firefox.exe");
            wd.navigate().to("https://www.google.co.in/");
            wd.manage().timeouts().implicitlyWait(50,TimeUnit.SECONDS);
            String Handle1 = wd.getWindowHandle();
            System.out.println("Window handle 1 is :- "+Handle1); 

The error logs are as follows:-

    Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: Bad request

Command duration or timeout: 1.58 seconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version:     '1.7.0'
Driver info: driver.version: FirefoxDriver    
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at     org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
    at             org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
    at     org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:182)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:185)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:178)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:174)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:92)
    at Example1.main(Example1.java:15)

My set up is :- Mozilla :- 17.0.1 Eclipse :- Helios (3.6) Selenium Java Bindings :- 2.25.0 OS :- Windows xp SP3

Help me folks . . . thanks in advance. It would be highly appreciated if someone helps me understand why this has happened.

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
Shoaib Shaikh
  • 343
  • 7
  • 22

3 Answers3

0

Support of Firefox 17 only appeared in WebDriver 2.25 (http://selenium.googlecode.com/svn/trunk/java/CHANGELOG). So, I suppose it can be not stable since you use 17.0.1 (a bit later). Also, please, try to use java 1.6 but not 1.7 as you did. Could you please tell us why you use so old versions of WebDriver and Firefox?

olyv
  • 3,699
  • 5
  • 37
  • 67
  • because this is the setup used for most of the modules in my project so to maintain the consistancy i need to go ahead with the current setup.Anyways thanx. . .!! – Shoaib Shaikh Oct 17 '13 at 05:45
0

You don't have to set property with firefox.

Try with the method get :

wd.open("your-url");
kev85270
  • 55
  • 2
  • 6
0

This may due to your hosts configuration. If you have a line like this: 127.0.0.1 domain1 domain2 domain3 localhost Change it to: 127.0.0.1 localhost domain1 domain2 domain3 Depending if you are under Linus or windows .... the location of that file is : /etc/hosts

Thanks :-)

mkebri
  • 2,025
  • 1
  • 16
  • 14