Chrome Profile Settings and Capybara 1.1 Stable

We previously blogged about how to test file downloads with capybara and chromedriver that explained how to create a profile that specified where to send downloaded files.

We had take a similar approach with a recent project, except instead of declaring a different download directory we were setting the window placement to alter Chrome’s size. This seems to have broken with a recent version of Chrome.

Instead of relying on settings like this to adjust Chrome’s window size:

profile['browser.window_placement.top'] = 0
profile['browser.window_placement.left'] = 0
profile['browser.window_placement.right'] = 10000
profile['browser.window_placement.bottom'] = 10000

Set the --window-size=width,height command-line switch by including the args hash option:

Capybara::Selenium::Driver.new(app,
  :browser => :chrome,
  :profile => profile,
  :args => ["--window-size=10000,10000"]
)
bryckbost@gmail.com

Comments

Add a Comment

Hmm...that didn't work.

Something went wrong while adding your comment. If you don't mind, please try submitting it again.

Comment Added!

Your comment has been added to this post. Please refresh this page to view it.

Optional. If added, we will display a link to the website in your comment.
Optional. Never shared or displayed in your comment.
  1. govinda.fichtner@googlemail.com
    Govinda
    May 04, 2013 at 5:16 AM

    Do you know how the equivalent commandline switch/arg for profile[“download.default_directory”] is?