I'm trying to do functional testing using Selenium Webdriver.
I'm using ruby code to test on multiple windows at the same time using multi-threading
The problem is when the thread creates the new window, the other window will lose focus and the send keys process from that window fill stop and the test fails.
How can I handle this window focus issue?
Thanks
Note: every browser window has its own driver instance
Update :
here How I create the thread
begin
while testIndex < testCases.length # End when every testcase has been tested
if(Thread.list.count<threadLimit+1) # if thread slot available
th[testIndex] = Thread.new(testIndex){ |i| # Create Thread
# get testCase input
# initiate driver and run test
# I have wraper for this, and there is no thread inside it, just single thread code
}
end
end
th.each{|t|
if(!t.nil?)
t.join # Wait unfinished thread
end
}
rescue Exception => e
puts "MESSAGE: #{e}"
end
Update II
Trying to investigate the issue again based on @Leon comment. and it's work, but just in Chrome it's failing in IE, FF, dan Phantom
The errors such as :
- CSRF token error (IE) - already using cleanSession and private, work on single thread test so it's not the web code error, this make selenium fail to find element which caused the script stoped,
- Unable to bind to locking port 7054 (Firefox),
- Unable to bind to locking port 8909 (Phantom)
Update III
Updated my selenium to 3.4 , the errors is gone. But the weird things is only phantomjs don't execute it concurrently.