2

I am unable to launch URL in Firefox. The browser is successfully launched but the URL that it open is :"https://www.mozilla.org/en-US/firefox/43.0.4/firstrun/learnmore/". And this browser closes itself after sometime.

This might be an issue with profile setting, but unsure how to fix this issue.

Code used:

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

public class Launchingbrowsers {

    public static void main(String[] args) {
        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.facebook.com/?_rdr=p");
    }
}

Please help with steps to resolve this issue

Andrew Regan
  • 5,087
  • 6
  • 37
  • 73
Suman Verma
  • 55
  • 1
  • 10
  • What are you trying to achieve? Irrespective of any Firefox issue, the very second the driver thinks it has loaded the Facebook page it will exit. Why not add a delay after the page load, or perform some actions and assertions? – Andrew Regan Feb 03 '16 at 22:45
  • adding wait command will not help because the URL that i am trying to get is not getting loaded.what my point was without using driver.quit() or, driver.close() the browser closes. – Suman Verma Feb 04 '16 at 05:46

4 Answers4

3

I think that's happening because the new issue occurs with latest update of Mozilla firefox.

It was happened with me too.

To overcome from this issue you need to setPreference as xpinstall.signatures.required", false to firefox Profile and then pass it to driver object

firefoxProfile.setPreference("xpinstall.signatures.required", false);

Below code is working fine for me.

static WebDriver driver=null;
public static void main(String[] args) {
    final FirefoxProfile firefoxProfile = new FirefoxProfile();
    firefoxProfile.setPreference("xpinstall.signatures.required", false);
    driver = new FirefoxDriver(firefoxProfile);
    driver.get("https://www.google.de/");

Hope it will help you :)

Shubham Jain
  • 16,610
  • 15
  • 78
  • 125
0

This may help you eliminate the Firefox "first run" page:

Firefox webdriver opens first run page all the time

Both of the top two answers (perhaps prefer https://stackoverflow.com/a/33939553/954442) suggest very plausible-looking FirefoxProfile configuration to eliminate the problem.

Community
  • 1
  • 1
Andrew Regan
  • 5,087
  • 6
  • 37
  • 73
0

I assume that your test is timeout because Firefox cannot load profile, so it can launch the browser but cannot navigate to your web. You have to downgrade Firefox, or upgrade Selenium, or downgrade both Firefox and Selenium.

Buaban
  • 5,029
  • 1
  • 17
  • 33
  • i am using the latest version of both selenium and firefox – Suman Verma Feb 04 '16 at 05:48
  • As I mentioned in the answer, you may need to downgrade firefox. Could you uninstall current firefox, download v.41 from this URL. https://ftp.mozilla.org/pub/firefox/releases/41.0/win32/en-US/, install and try to run test again? – Buaban Feb 04 '16 at 06:14
  • i tried that but still i m facing issues.i tried opening facebook by driver.get() method.but no clue why, Firefox was launched but with 2 irrelevant tabs. – Suman Verma Feb 28 '16 at 19:47
  • Error generated was :Caused by: org.openqa.selenium.WebDriverException: Target URL www.facebook.com is not well-formed. Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:03:33' System info: host: 'suman', ip: '192.168.1.4', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_45' Driver info: driver.version: unknown at .FirefoxDriver.prototype.get(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10589) (1/2) – Suman Verma Feb 28 '16 at 19:48
  • (2/2)at .DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12614) at .DelayedCommand.prototype.executeInternal_(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506webdriver-profile/extensions/fxdriver@googlecode.com/components/command-processor.js:12619) at .DelayedCommand.prototype.execute/<(file:///C:/Users/SumanV/AppData/Local/Temp/anonymous7235374065244074506 – Suman Verma Feb 28 '16 at 19:48
0

There are two possible solutions.

  1. You need to disable the first run page of Firefox to make it working. This you can be achieved by setting preferences

    FirefoxProfile prof = new FirefoxProfile(); prof.SetPreference("browser.startup.homepage_override.mstone", "ignore"); prof.setPreference("startup.homepage_welcome_url.additional", "about:blank"); driver = new FirefoxDriver(prof);

and you will not face this issue :)

  1. If Solution in point 1 doesn't help, then upgrade Selenium WebDriver will solve the issue.

Hope this helps :)

Eugene S
  • 6,709
  • 8
  • 57
  • 91
Sarabjit Singh
  • 786
  • 4
  • 4