RUBY
Approach #1
options = {
'chromeOptions' => {
'args' => ['start-fullscreen']
}
}
caps = Selenium::WebDriver::Remote::Capabilities.chrome(options)
@driver = Selenium::WebDriver.for :chrome, desired_capabilities: caps
Approach #2
options = {
'chromeOptions' => {
'args' => ['window-size=640,480']
}
}
caps = Selenium::WebDriver::Remote::Capabilities.chrome(options)
@driver = Selenium::WebDriver.for :chrome, desired_capabilities: caps
Approach #3
max_width, max_height = @driver.execute_script("return [window.screen.availWidth, window.screen.availHeight];")
@driver.manage.window.resize_to(max_width, max_height)
Approach #4
@driver.manage.window.maximize
Approach #5
target_size = Selenium::WebDriver::Dimension.new(1600, 1268)
@driver.manage.window.size = target_size
Approach #6
@driver.manage.window.resize_to(640, 480)
Approach #7
@driver.execute_script("window.resizeTo(640, 480);")