adamdriscoll/selenium-powershell

How to Close or quit the driver ?

Closed this issue · 4 comments

Can you please help how to close this driver at end of the program after opening url

Memory's a bit fuzzy but if you're using -AsDefaultDriver currently you can grab the driver object from $global:SeDriver (if you're not you should have a driver object stored to a variable somewhere).

Once you have the driver object, iirc you just call .Dispose() on it; $global:SeDriver.Dispose() or similar if you have it stored in a variable yourself. Closing the browser manually usually closes the driver too, if memory serves.

ct stored t

Memory's a bit fuzzy but if you're using -AsDefaultDriver currently you can grab the driver object from $global:SeDriver (if you're not you should have a driver object stored to a variable somewhere).

Once you have the driver object, iirc you just call .Dispose() on it; $global:SeDriver.Dispose() or similar if you have it stored in a variable yourself. Closing the browser manually usually closes the driver too, if memory serves.

this works

Stop-SeDriver -Driver $Driver

and one more query..

$Driver = Start-SeChrome -Maximized

$urls= gc "C:\CSV\aburl.txt"
foreach ($url in $urls){
    #Write-Host "Url is: $url"	
	Enter-SeUrl $url -Driver $Driver}
	Start-Sleep -Seconds 10

Stop-SeDriver -Driver $Driver

but this Sleep is not working properly any idea why ?

Stop-SeDriver -Driver $Driver resolved the issue