Description
Currently the Selenium module stores the driver object in the $global:
space when you start a driver with -AsDefaultDriver
, which seems a bit unwise, to me at least.
I'd be inclined to say it would be better to store it in the module scope (aka $script:
scope) and then provide users with a Get-SeDriver
function to retrieve the current default driver if they have a transient need for it later.
Naturally some of this is made easier in that we can just store the driver objects initially, but in complex Pester scripts it sometimes requires jumping through a few hoops to keep that variable easily accessible, and it's also quite repetitive to keep referencing the driver directly.
-AsDefaultDriver
is really nice, but it'd be good to have a bit nicer interface with the less-accessible driver when it's needed, preferably without putting anything directly in the global scope. 🙂