Skip to content
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

Fix windowSize option in Firefox in Javascript #6075

Merged
merged 2 commits into from Jun 28, 2018

Conversation

rodmcnew
Copy link
Contributor

@rodmcnew rodmcnew commented Jun 26, 2018

Hi guys.

"--window-size" is for screenshots only in Firefox, not the size of the Firefox window itself.
"--width" and "--height" are the proper way to set the dimensions of a Firefox window from the CLI.

Proof:

firefox -h | grep screenshot
 --screenshot [<path>] Save screenshot to <path> or in working directory.
 --window-size width[,height] Width and optionally height of screenshot.

Works (after my change):

firefox --width=1920 --height=1080

Doesn't work (before my change):

firefox --window-size=1920,1080

Copy link

@bradharms bradharms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: What @rodmcnew said.

@rodmcnew rodmcnew changed the title fix windowSize({width, height}) option in firefox fix windowSize({width, height}) option in firefox in node JS Jun 26, 2018
@rodmcnew rodmcnew changed the title fix windowSize({width, height}) option in firefox in node JS fix windowSize({width, height}) option in Firefox in Javascript Jun 26, 2018
@rodmcnew rodmcnew changed the title fix windowSize({width, height}) option in Firefox in Javascript Fix windowSize({width, height}) option in Firefox in Javascript Jun 26, 2018
@rodmcnew rodmcnew changed the title Fix windowSize({width, height}) option in Firefox in Javascript Fix windowSize option in Firefox in Javascript Jun 26, 2018
@jleyba jleyba merged commit c4acbe5 into SeleniumHQ:master Jun 28, 2018
@pertamaks
Copy link

`opt_fox = Selenium::WebDriver::Firefox::Options.new
opt_fox.add_argument('--width=1024') #your preferred size
opt_fox.add_argument('--height=700') #your preferred size

Capybara.register_driver :firefox do |app|
Capybara::Selenium::Driver.new(app, browser: :firefox, options: opt_fox)
end`

to work with Capybara.
Will leave it here, maybe someone in need,
or, maybe someone can make it better,

@codebymikey
Copy link

This doesn't work for me in headless mode for the nodejs driver, setting it through an environment variable does though.

process.env.MOZ_HEADLESS_WIDTH = 1280;
process.env.MOZ_HEADLESS_HEIGHT = 1024;

References:
mozilla/geckodriver#1354 (comment)
https://github.com/mozilla/gecko-dev/blob/d3860ab2859aafd9eb1551e0f9035c5779bc38f1/testing/geckodriver/doc/Testing.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants