0
votes

I'm working with send_keys where I have to hit Enter

@ie.element(:css, "#accountSwitcherSelect.dijitDownArrowButton").send_keys :enter

which makes another object that switches accounts visible

@ie.div(:id => "accountSwitcherSelect_dropdown").table(:id => "accountSwitcherSelect_menu")

Here's the kicker, it works perfectly if I'm there, and the browser is in focus in the foreground.

But, if I either a) lock the Windows OS screen, or b) are working on a Remote Desktop and switch out of RDP, or c) started running the ruby script from a scheduled task on an unattended machine it will see the first dropdown just fine

puts @ie.element(:css, "#accountSwitcherSelect.dijitDownArrowButton").visible?

but it never does send_keys :enter and never will see "accountSwitcherSelect_menu" and throws

timed out after 60 seconds

error

watir 6.10.3, ruby 2.2.5, Windows OS, IE 11

--Here's the full error message, where line 125 is

@ie.element(:css, "#accountSwitcherSelect.dijitDownArrowButton").send_keys :enter

C:/ruby225/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/wait_helper.rb:20:in wait_until': timed out after 60 seconds (RAutomation::WaitHelper::TimeoutError) from C:/ruby225/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/win_32/window.rb:153:in block in send_keys' from C:/ruby225/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/win_32/window.rb:152:in each' from C:/ruby225/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/adapter/win_32/window.rb:152:in send_keys' from C:/ruby225/lib/ruby/gems/2.2.0/gems/rautomation-0.17.0/lib/rautomation/window.rb:192:in send_keys' from C:/ruby225/lib/ruby/gems/2.2.0/gems/watir-classic-4.3.0/lib/watir-classic/browser.rb:452:in send_keys ' from C:/ruby225/lib/ruby/gems/2.2.0/gems/watir-classic-4.3.0/lib/watir-classic/element.rb:124:in send_keys ' from DeleteTriggers8.rb:125:inblock in ' from DeleteTriggers8.rb:106:in each' from DeleteTriggers8.rb:106:in'

1
Kindly paste the whole error message - Rajagopalan
"timed out after 60 seconds" is the whole error message I get when doing begin rescue Exception => e puts "\nException caught as of #{Time.now}: #{e}" - Mark
No remove the rescue block and run the program and get the whole message and update it in the question.. - Rajagopalan
Are you using WATIR(Powered by Selenium) Or WATIR -classic? Because rautomation-0.17.0/ is in watir-classic which has already been deprecated. - Rajagopalan
Thank you @Rajagopalan the browser window focus issue seemed to be a limitation of now deprecated watir-classic. Switching to later watir-webdriver solves the problem. - Mark

1 Answers

0
votes

Thank you @Rajagopalan the browser window focus issue seemed to be a limitation of now deprecated watir-classic. Switching to latest watir-webdriver solves the problem.