4

I tried to use FirefoxPortable with selenium from my Windows 7 OS but I'm having difficulty.

So, I launched selenium RC server with the default folder profile of FirefoxPortable :

java -jar selenium-server-standalone-2.42.2.jar -firefoxProfileTemplate "V:\Utilitaires\FirefoxPortable\Data\profile" -port 4444 -log selenium.log

Next I launched a standard test with phpunit and set browser like this:

$this->setBrowser("*firefox V:\Utilitaires\FirefoxPortable\FirefoxPortable.exe");

This one is ok with standard firefox (without FFPortable path) but with the portable edition i'm stuck.

It seems the FF profile is well loaded and the browser is well launched but nothing happens (I stay on blank page) , the "Selenium Core page" (where we see selenium instructions) does not opens....

This is the selenium log with standart FF :

10:06:10.245 INFO [31] org.openqa.selenium.server.SeleniumDriverResourceHandler -    Command request: getNewBrowserSession[*firefox, http://automate.local.seatpi.fr] on session null
10:06:10.245 INFO [31] org.openqa.selenium.server.BrowserSessionFactory - creating new remote session
10:06:10.254 INFO [31] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 2a97be5fa2b74f9c968e2239cb9f268b for http://automate.local.seatpi.fr, launching...
10:06:10.388 INFO [31] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
10:06:11.589 INFO [31] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...
10:06:13.935 INFO [31] org.openqa.selenium.server.SeleniumDriverResourceHandler - Got result: OK,2a97be5fa2b74f9c968e2239cb9f268b on session 2a97be5fa2b74f9c968e2239cb9f268b
10:06:13.938 INFO [31] org.openqa.selenium.server.SeleniumDriverResourceHandler - Command request: setTimeout[30000, ] on session 2a97be5fa2b74f9c968e2239cb9f268b
10:06:13.959 INFO [31] org.openqa.selenium.server.SeleniumDriverResourceHandler - Got result: OK on session 2a97be5fa2b74f9c968e2239cb9f268b

And with FF Portable :

10:03:00.364 INFO [15] org.openqa.jetty.util.Credential - Checking Resource aliases
10:03:00.367 INFO [15] org.openqa.selenium.server.SeleniumDriverResourceHandler - Command request: getNewBrowserSession[*firefox V:\Utilitaires\FirefoxPortable\FirefoxPortable.exe, http://automate.local.seatpi.fr] on session null
10:03:00.369 INFO [15] org.openqa.selenium.server.BrowserSessionFactory - creating new remote session
10:03:00.380 INFO [15] org.openqa.selenium.server.BrowserSessionFactory - Allocated session 0a72901b5b6c44f5b2f90f9e4ddc9b8e for http://automate.local.seatpi.fr, launching...
10:03:00.592 INFO [15] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
10:03:01.246 INFO [15] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...
10:03:17.933 INFO [16] org.openqa.selenium.server.SeleniumDriverResourceHandler - Command request: getNewBrowserSession[*firefox V:\Utilitaires\FirefoxPortable\FirefoxPortable.exe, http://automate.local.seatpi.fr] on session null
10:03:17.938 INFO [16] org.openqa.selenium.server.BrowserSessionFactory - creating new remote session
10:03:17.939 INFO [16] org.openqa.selenium.server.BrowserSessionFactory - Allocated session d88cfd3bdf81498a8f2c92c3ebbd3ae0 for http://automate.local.seatpi.fr, launching...
10:03:18.070 INFO [16] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Preparing Firefox profile...
10:03:22.421 INFO [16] org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher - Launching Firefox...

Do you have any idea to solve my problem ?

4
  • Why are you using FF portable with Selenium? If you're worried about browser versioning might I suggest virtual machines and/or SauceLabs? Jan 3, 2015 at 8:08
  • Hello! Because I use Selenium in a homemade portable automate (USB) which can be mounted on any computer and execute scenarios!
    – kain34440
    Jan 5, 2015 at 9:47
  • Can you please tell me what language the solution code is in and in which file it should be placed? I'm learning Python and some Java. I also started learning Javascript.
    – Alex
    Aug 25, 2022 at 6:05

1 Answer 1

1

The problem is that the driver.get() (and the driver.navigate().to()) methods both use native events to navigate the browser. Firefox native events are supported only for up to version 31.0.6 of Firefox. If your using a later version of Firefox portable (v32+), it's not going to work that easily. That is the reason that you see the browser open and your .get call fails. So, all you need to do is create your own navigate method that navigates with Javascript instead of using the Selenium native event.

public void nonNativeNavigateBrowser(WebDriver driver, URL url)
{
    JavascriptExecutor js;
    if (driver instanceof JavascriptExecutor) {
        js = (JavascriptExecutor)driver;
    }
    js.executeScript("window.location.href('" + url.toExternalForm() + "');");
}

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.