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

  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?