I'm trying to use the WebDriver DLL via PowerShell. I keep getting the following Exception everytime:
format-default : The following exception occurred while retrieving members: "Could not load file or
assembly 'WebDriver, Version=2.48.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified."
+ CategoryInfo : NotSpecified: (:) [format-default], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMembers,Microsoft.PowerShell.Commands.FormatDefaultCommand
This is my code:
[Reflection.Assembly]::LoadFile("X:\WebDriver.dll")
[Reflection.Assembly]::LoadFile("X:\Winium.WebDriver.dll")
[Reflection.Assembly]::LoadFile("X:\Elements.Desktop.dll")
[Reflection.Assembly]::LoadFile("X:\Winium.Cruciatus.dll")
$options = [OpenQA.Selenium.Winium.DesktopOptions]::new()
$options
This is my output:
GAC Version Location
--- ------- --------
False v4.0.30319 X:\WebDriver.dll
False v4.0.30319 X:\Winium.WebDriver.dll
False v4.0.30319 X:\Winium.Elements.Desktop.dll
False v4.0.30319 X:\Winium.Cruciatus.dll
format-default : The following exception occurred while retrieving members: "Could not load file or
assembly 'WebDriver, Version=2.48.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified."
+ CategoryInfo : NotSpecified: (:) [format-default], ExtendedTypeSystemException
+ FullyQualifiedErrorId : CatchFromBaseGetMembers,Microsoft.PowerShell.Commands.FormatDefaultCommand
I'm not sure what is wrong over here. Could someone please help me out?
You are not give details, of OS version, PowerShell version, whether you were doing this as Admin or regular user, etc...
Anyway, switch this...
to this ...
Sure, for the most part, they are for the same goal but try it.
See this blog:
Modules should be in the PSModuelPath, to allow PowerShell to find and autoload them if possible. Though sure, you can explicitly load from any UNC (as noted by your post and the snippet included in my response) but why force that effort.