Saturday, May 12, 2018

Selenium Web-Driver - Power-shell script for to Kill all Web-Driver Instants.


Selenium Web-Driver - Create Power-shell script for to Kill all Web-driver instants which are open during the execution.

- Steps -
01. Create PowerShell Script using bellow code lines
02. Right click on the script & execute.

         
 Clear-Host
 Write-Host
 $a = Get-Location
 echo "Running from: $a.Path"
 Write-Host
 Write-Host
 # Set-Location -Path C:\Windows

 Write-Host "test for Phantom JS"
 $pjs = get-Process -processname phantomjs -EA SilentlyContinue

 Write-Host "test for ChromeDriver"
 $chd = get-Process -processname chromedriver -EA SilentlyContinue



 Write-Host "Press any key to stop driver processes ..."
 $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

 Write-Host "Stopping Phantom JS"
 Stop-Process -processname phantomjs -EA SilentlyContinue
 Write-Host "Stopping ChromeDriver"
 Stop-Process -processname chromedriver -EA SilentlyContinue
 # Write-Host "Stopping Chrome Browsers"
 # Stop-Process -processname chrome -EA SilentlyContinue


 Write-Host "Press any key to continue ..."
 $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")   






Enjoy!!!

#ThinkSimple

No comments:

Post a Comment