New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails for integer parameters (Firefox) #4445

Closed
iliakan opened this Issue Aug 11, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@iliakan

iliakan commented Aug 11, 2017

OS: MacOS 10.12
Selenium Version: 3.5.0
Browser: Firefox 52.3
Geckodriver: 0.18.0 (downloaded latest today)
Node.JS module selenium-webdirver: 3.5.0 (downloaded latest today)

I'm trying to set browser.download.folderList to 2, but Selenium sends it as 2.0 to geckodriver, so that it crashes.

Steps to reproduce

Here's the code for Node.JS that requires only selenium-webdriver installed.
That might not be selenium-webdriver problem though, maybe it's a Java code issue.

const SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
const webdriver = require('selenium-webdriver');
const firefox = require('selenium-webdriver/firefox');

const seleniumServer = new SeleniumServer('./vendor/selenium-server-standalone.jar', {
  args: ['-debug'],
  stdio: 'inherit'
});

seleniumServer.start();
const profile = new firefox.Profile();
profile.setPreference("browser.download.folderList", 2);

const options = new firefox.Options().setProfile(profile);

const driver = new webdriver.Builder()
  .usingServer(seleniumServer.address())
  .withCapabilities({
    browserName: 'firefox',
    name:        require('os').hostname + ': ' + new Date().toLocaleString()
  }).
  setFirefoxOptions(options).
  build();

From the debug output:

23:54:10.194 DEBUG - http-outgoing-0 >> "{"desiredCapabilities":{"browserName":"firefox","name":"function getHostname() { [native code] }: 2017-8-11 23:54:09","moz:firefoxOptions":{"prefs":{"browser.download.folderList":2.0}}}}"

You can see 2.0 here, so geckodriver dies.

It worked in older selenium, I upgraded it first time in half-year or like that, and got the regression.

@iliakan

This comment has been minimized.

Show comment
Hide comment
@iliakan

iliakan Aug 14, 2017

@barancev Please note that Node.JS actually passes integer to selenium.

That's an excerpt from my larger app log:

POST /wd/hub/session HTTP/1.1
Accept: application/json; charset=utf-8
Content-Length: 362
Content-Type: application/json;charset=UTF-8
Host: 192.168.1.5:4444
Connection: close

{"desiredCapabilities":{"browserName":"firefox","name":"function getHostname() { [native code] }: 2017-8-14 14:35:30","moz:firefoxOptions":{"prefs":{"browser.download.manager.showWhenStarting":false,"browser.download.dir":"/js/payments/tmp","browser.download.folderList":2,"browser.helperApps.neverAsk.saveToDisk":"application/excel,application/octet-stream"}}}}

But Selenium passes 2.0 to geckodriver (Wrong!)

POST /session HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 364
Host: localhost:23192
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121)
Accept-Encoding: gzip,deflate

{"desiredCapabilities":{"browserName":"firefox","name":"function getHostname() { [native code] }: 2017-8-14 14:35:30","moz:firefoxOptions":{"prefs":{"browser.download.manager.showWhenStarting":false,"browser.download.dir":"/js/payments/tmp","browser.download.folderList":2.0,"browser.helperApps.neverAsk.saveToDisk":"application/excel,application/octet-stream"}}}}

iliakan commented Aug 14, 2017

@barancev Please note that Node.JS actually passes integer to selenium.

That's an excerpt from my larger app log:

POST /wd/hub/session HTTP/1.1
Accept: application/json; charset=utf-8
Content-Length: 362
Content-Type: application/json;charset=UTF-8
Host: 192.168.1.5:4444
Connection: close

{"desiredCapabilities":{"browserName":"firefox","name":"function getHostname() { [native code] }: 2017-8-14 14:35:30","moz:firefoxOptions":{"prefs":{"browser.download.manager.showWhenStarting":false,"browser.download.dir":"/js/payments/tmp","browser.download.folderList":2,"browser.helperApps.neverAsk.saveToDisk":"application/excel,application/octet-stream"}}}}

But Selenium passes 2.0 to geckodriver (Wrong!)

POST /session HTTP/1.1
Content-Type: application/json; charset=utf-8
Content-Length: 364
Host: localhost:23192
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_121)
Accept-Encoding: gzip,deflate

{"desiredCapabilities":{"browserName":"firefox","name":"function getHostname() { [native code] }: 2017-8-14 14:35:30","moz:firefoxOptions":{"prefs":{"browser.download.manager.showWhenStarting":false,"browser.download.dir":"/js/payments/tmp","browser.download.folderList":2.0,"browser.helperApps.neverAsk.saveToDisk":"application/excel,application/octet-stream"}}}}
@iliakan

This comment has been minimized.

Show comment
Hide comment
@iliakan

iliakan Aug 14, 2017

So that's probably a Java issue rather than Node.JS driver.

iliakan commented Aug 14, 2017

So that's probably a Java issue rather than Node.JS driver.

@barancev barancev added the C-remote label Aug 14, 2017

@jleyba jleyba added C-java and removed C-nodejs labels Aug 16, 2017

@shs96c

This comment has been minimized.

Show comment
Hide comment
@shs96c

shs96c Aug 21, 2017

Member

Technically, this is a problem with remote ends not handling JS correctly --- there's no concept of "float" or "int", just "number".

google/gson#1084

Having said that, things breaking is bad, so we need to put a fix of some sort into selenium

Member

shs96c commented Aug 21, 2017

Technically, this is a problem with remote ends not handling JS correctly --- there's no concept of "float" or "int", just "number".

google/gson#1084

Having said that, things breaking is bad, so we need to put a fix of some sort into selenium

@shs96c

This comment has been minimized.

Show comment
Hide comment
@shs96c

shs96c Aug 21, 2017

Member

This should be fixed by 1df7898

Member

shs96c commented Aug 21, 2017

This should be fixed by 1df7898

@barancev

This comment has been minimized.

Show comment
Hide comment
@barancev

barancev Aug 22, 2017

Member

Version 3.5.2 released with this fix.

Member

barancev commented Aug 22, 2017

Version 3.5.2 released with this fix.

@barancev barancev closed this Aug 22, 2017

@iliakan

This comment has been minimized.

Show comment
Hide comment

iliakan commented Aug 22, 2017

Awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment