Reputation: 11
I'm trying to send keystroke in a ruby automation, I don't know how to put this in my code, I want to send (Alt+Space + X) to maximize my window.
Anyone could help me in this one?
When("que eu realize login no SIAF com usuário e senha") do |table|
wsh.SendKeys("%{VK 32}{VK 88}")
@usuario = table.rows_hash['usuario']
@senha = table.rows_hash['senha']
login.load
login.log(@usuario,@senha)
end
I expect window to be maximized by command Alt+Space+X, but nothing happens.
My "env.rb" I´m using like this:
require 'capybara'
require 'capybara/dsl'
require 'capybara/rspec/matchers'
require 'selenium-webdriver'
require 'site_prism'
require 'rspec'
require_relative 'page_helper.rb'
World(Capybara::DSL)
World(Capybara::RSpecMatchers)
World(Pages)
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
mange.window.maximize
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
'chromeOptions' => {'args' => ['--disable-infobars',
'window-size=1600,1024'] }
)
)
end
Where can I put "Drive.mangage.window.maximize" ?
Upvotes: 1
Views: 430
Reputation: 49890
Keys you send are sent to the browser, not the OS, so aren't guaranteed to trigger system actions. To maximize the window your best best is
page.current_window.maximize
Upvotes: 1