selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: JS firefox driver crashes on setting a profile.

Open kabell opened this issue 3 years ago • 3 comments

What happened?

I want to use a custom firefox profile, so I set it according the documentation.

However then my code crashes with the provided error.

When I investigated why it is unable to serialize the object to JSON, I found httpRequest.data contains content of the specified firefox profile which is about 200MB in size and it reaches the maximum length of the string. However, the profile should be used for the browser, not be attached to the request body. Is it a bug, or I'm doing something wrong ? In python, using the custom profile works without problems.

How can we reproduce the issue?

const {By,Key,Builder} = require("selenium-webdriver");
const firefox = require('selenium-webdriver/firefox');

async function example(){

       let profile = '/home/kabell/.mozilla/firefox/4rmepnvo.default-release';
       let options = new firefox.Options().setProfile(profile);

       //To wait for browser to build and launch properly
       let driver = await new Builder().forBrowser("firefox").setFirefoxOptions(options).build();

        //To fetch http://google.com from the browser with our code.
        await driver.get("http://google.com");

        //It is always a safe practice to quit the browser after execution
        await driver.quit();

}

example()

Relevant log output

/home/kabell/selenium/node_modules/selenium-webdriver/http/index.js:132
      data = JSON.stringify(httpRequest.data)
                  ^

RangeError: Invalid string length
    at JSON.stringify (<anonymous>)
    at HttpClient.send (/home/kabell/selenium/node_modules/selenium-webdriver/http/index.js:132:19)
    at Executor.execute (/home/kabell/selenium/node_modules/selenium-webdriver/lib/http.js:470:33)


### Operating System

Ubuntu

### Selenium version

Javascript 4.1.1

### What are the browser(s) and version(s) where you see this issue?

Firefox 97

### What are the browser driver(s) and version(s) where you see this issue?

Geckodriver 0.30.0

### Are you using Selenium Grid?

_No response_

kabell avatar Feb 23 '22 07:02 kabell

@kabell, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Feb 23 '22 07:02 github-actions[bot]

I am triaging this issue.

TamsilAmani avatar May 26 '22 14:05 TamsilAmani

We generally recommend using prefs and args directly instead of profile if at all possible. There are a number of Firefox Profile related issues.

titusfortner avatar May 26 '22 21:05 titusfortner

Hi,

This should be mostly fixed with commit!

fix will be available in v4.5!

harsha509 avatar Sep 12 '22 05:09 harsha509

Closing this as resolved! fix will be available in v4.5 which will be released later this week!

harsha509 avatar Sep 15 '22 15:09 harsha509

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Oct 16 '22 00:10 github-actions[bot]