6

I have created a simple test that launches browser and calls a URL. This works fine in IE but when I select Firefox (FF) browser it opens a blank page. See the code snippet below.

The issue is similar to this post that concludes one has to change the settings in about:config's toolkit.telemetry.prompted to 2.

But in my case its already 2, hence I have posted the issue.

Any help would be appreciated.

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;

import com.thoughtworks.selenium.*;

public class BascOne  extends SeleneseTestBase {
    private SeleniumServer seleniumserver;

    //start the selenium server
    @Before
    public    void startServer()
    {
        try {


        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }


    @Test
    public void launchTest() throws Exception
    {
        seleniumserver = new SeleniumServer();

        seleniumserver.start();


        setUp("http://yahoo.com/", "firefox");
        selenium.windowMaximize();
        selenium.windowFocus();


        System.out.println("IN THE  TEST METHOD");

        selenium.open("http://yahoo.com/");    

        System.out.println("BEFORE WAIT");        

        if(selenium != null){
            System.out.println("Is there any exception");
            try {
                System.out.println("In the try block");

                selenium.close();
                selenium.shutDownSeleniumServer();        


            } catch(Exception exp) {
                System.out.println("Shutdown exception: " + exp.getMessage());
            }

        }

    }


    @After
    public void tearDown()  {
    }    
}
3
  • 1
    May I suggest to use WebDriver APIs (aka Selenium 2) if you have begun with Selenium?
    – Tarun
    Commented Nov 15, 2012 at 5:33
  • On a side, how does it compile if in startServer() has no block throwing exception?
    – dzieciou
    Commented Nov 15, 2012 at 7:00
  • I am also facing same issue. but when i run program using JUnit it runs successfully and with TestNG FF shows blank screen. Please help
    – user4442
    Commented Nov 27, 2012 at 6:47

2 Answers 2

3

This is because of compatibility issue with your browser and Selenium libs. Selenium libs 2.16 supports Firefox version 3.6 to 11, and for 12 you have to upgrade your Selenium libs to 2.22.

1

I had a similar issue and found the problem was the combination of firefox version and selenium server version. You could try either downgrading firefox or upgrading selenium to the latest version.

Check out http://seleniumhq.org/about/platforms.html#browsers browsers supported in the latest versions, note that the latest version only supports up to firefox 10 at the moment...

3
  • yes, I did downgrade to 3.6(was using that earlier) & it works. based on the link that u sent, will try v 10 & see if that helps as well. Commented May 29, 2012 at 6:41
  • 1
    No, I face the same issue. Get message from FF when it launches - Will you help FF by sending anonymous information about performance, hardware characteristics ...... to mozilla. And 2 options : Yes, I want to help or no. After clicking on either of them I am not able to proceed anywhere. Commented May 29, 2012 at 7:01
  • Yes downgrading the FF browser worked for me.....last time i had also tried to update the version of Sel Webdriver and it worked too...thanks
    – user19418
    Commented Jul 21, 2016 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.