0

So i'm trying to automate a desktop app using winium and i want to automate the launching of the winium driver thru script, so far i'm able to start it just fine, but when it comes to closing it, that's the problem.

winium = Thread.new{
   system (
      File.dirname(__FILE__) 
      +'/Features/Support/support/Winium.Desktop.Driver.exe')
} 
sleep 5 
winium.kill

But after i kill the thread, if i check with TCPView i can see that winium is still open, this will cause issues if i try to running the script multiple times without winium closing correctly.. My question is how can i make sure that Winium is stopping after i kill the thread?

i'm working in rubyMine, with ruby 2.4.4 and using the 1.6.0 version of the winium driver.

Alexis Delahaye
  • 644
  • 5
  • 18
  • https://ruby-doc.org/core-2.2.0/Thread.html#method-i-kill - says it termintes the thread and schedules another thread to be run? – Mark May 16 '18 at 13:09
  • I did `a = Thread.new { //some infinite loop }` , then `a.kill`, I got : `` , so I retried `a.kill` and got this time `` Maybe you need to kill it twice ? – Alexis Delahaye May 16 '18 at 13:28
  • I tried and i still see Winium running in TCPView, maybe i have to use socket to close the port and that will do it? – Leonardo De Oliveira May 16 '18 at 13:44
  • i found a solution to this, i passed the taskkill ccommand to the console with the image name for winium and did a forceful exec and that does the trick.`system ('taskkill /IM Winium.Desktop.Driver.exe /f')` – Leonardo De Oliveira May 16 '18 at 14:18

1 Answers1

0

I found a solution to this, i passed the taskkill command to the console with the image name for winium and did a forceful exec and that does the trick. system ('taskkill /IM Winium.Desktop.Driver.exe /f')