#need to check the browser version is IE via webdriver as other browsers like ff and chrome do not to be maximised if(page.driver.browser.browser.to_s == "internet_explorer") page.driver.browser.manage.window.maximize end
Wednesday, June 20, 2012
IE webdriver maximize window
Running cucumber test with webdriver in Internet Explorer browser has alot of issues. One issue that I encounter is that the IE browser window is not opening in a maximized state. Apparently, webdriver needs to have IE browser fully maximize in order for webdriver to be able to locate elements.
A workaround that I use is to maximize the IE browser on my first cucumber steps.
To change/resize the browser window:
IE undefined method map for nil class
I get the following error when running webdriver in IE 7 and 8. I am using ruby, Capybara with selenium webdriver version 2.2.24
Undefined method `map` for nil:NilClass (NoMethodError) or NoMethodError Exception: undefined method `map` for nil:NilClassIt seems that IE stand alone webdriver could not switch between http to https then to http again correctly and therefore it could not find any of the DOM element. This also cause the error of unable to delete cookie in IE
Selenium::WebDriver::Error:JavascriptError Exception: Unable to delete cookie with name 'cookiename'The workaround that I have for this Internet explorer webdriver issue is to start the session with https instead of http. This seem to have solve the issue. Alternatively, during the session you can make the test to visit a https page and then visit the current page again.
Capybara refresh back forward a page
To refresh a page in Capybara using selenium webdriver simply call the webdriver method directly
page.driver.browser.navigate.refresh (to, back, forward) or you can use the visit 'url' method
Capybara save page method
This is a pretty useful method to save the current active page for debugging.
This method can be triggered when the scenario fail.
After do |scenario|
if scenario.failed?
page.save_page
end
end
This will create a file called capybara-timestamp.html in the current directory
Subscribe to:
Posts (Atom)