I know this is a very silly question. Yet, am not able to find how to make the browser open in fullscreen mode using watir webdriver. i tried using maximize() but in vain. This is how the code looks like:
require "rubygems"
require "watir-webdriver"
ff = Watir::Browser.new(:firefox)
ff.goto("http://google.com")
ff.maximize()
getting the error "undefined method maximize"
Watir is an open-source web application testing framework that is designed to make writing Selenium tests simple and efficient. Built on Selenium's Ruby language bindings, Watir is able to drive the browser in the same way humans do.
Definition: Watir, pronounced as water, is a group of Ruby libraries for automated web browsers. It allows writing the tests which are easy to read and maintain. In other words, it is a simple and flexible tool. Description: Watir drives the browsers the same way as people do.
Watir-WebDriver (Watir is short for Web Application Testing in Ruby) is a Ruby gem which allows you to automate your browser (make it click a button, submit a form, wait for some text to appear before continuing, and so on).
Right now, it's possible to maximize the browser doing:
require "rubygems"
require "watir-webdriver"
browser = Watir::Browser.new(:firefox)
browser.goto("http://google.com")
browser.driver.manage.window.maximize
Actually is going down to Selenium Driver to handle it, and AFAIK it works fine in Firefox and Chrome.
what worked for me is the following
in hooks.rb (if you are using cucumber)
Before do
@browser = Watir::Browser.new :firefox #( :chrome, :ie, etc)
@browser.driver.manage.window.maximize
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With