Reputation: 1213
I am executing automated tests with cucumber and the selenium webdriver connected to Google Chrome and I need to change the zoom at the browser to avoid errors at some automated tests.
The zoom can be changed by pressing the keys Control + '-' or Control + '-'.
In order to simulate the pressing of theese keys I have added a Hook with this code:
Before ('@ChangeBrowserZoom') do
page = Capybara::page
page.find("html").send_keys(:control , '+')
page.find("body").native.send_keys(:control , '+')
end
The hook is been called but it is not working.
Upvotes: 0
Views: 1041
Reputation: 679
Selenium send_keys method call args one by one in your code. For calling it together use square brackets:
Before ('@ChangeBrowserZoom') do
page = Capybara::page
page.find("html").send_keys([:control , :add])
end
Upvotes: 2