Some basic understanding questions about using DLLs

Hello all,
quite some time has passed since my last post :).
I'm trying to use some .Net dll in Powershell and having some knowledge gaps there which you might be able to fill.Basically I'm trying to automate a Werbbrowser using selenium. I found an nice blogpost about it
He explains the code in the comments but unfortunately that it isn't enough for me to understand the topic.
Here is the code which I used and worked:
$env:PATH += ";C:\Temp\PSL\" # Adds the path for ChromeDriver.exe to the environmental variable
Add-Type -Path "C:\Temp\PSL\WebDriver.dll" # Adding Selenium's .NET assembly (dll) to access it's classes in this PowerShell session
$ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver # Creates an instance of this class to control Selenium and stores it in an easy to handle variable
Here is my understanding and questions:
It seems we are loading some Net dlls. But after we added the DLL we are creating some object using "New-Object" based on the DDL. Please correct me if I'm wrong.
1) From where would I know how to use the dll or create a object from it if I can't read the .dll itself in Plaintext or any IDE? Sure I have the filenames but that's it "Webdriver.dll" + "WebdriverSupport.dll"
I'm talking about this part of the New-Object command "OpenQA.Selenium.Chrome.ChromeDriver".
2) is there any other way to load a dll besides Add-Type -Path "C:\Temp\PSL\WebDriver.dll"?
3) Also I found several different "Language Bindings" on the Selenium website. What are "Language Bindings"?
Am I right that only C# Language Bindings are usable in Powershell?
On the selenium Website I found some examples for using a wait in C#. But how can I use these examples for Powershell. I thing I need to create the objects but PS gives me some errors.
Please find the selenium webpage examples below.
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
IWebElement firstResult = wait.Until(e => e.FindElement(By.XPath("//a/h3")));
What I tried in PS.
$wait =  New-Object OpenQA.Selenium.Chrome.WebDriverWait(ChromeDriver, TimeSpan.FromSeconds(10));
-> Doesnt work. My Chromedriver Object is named "Chromedriver".
Best Regards,

I’m aware of the selenium module in Powershell, but I try to get a better understanding of using DLLs in Powershell.

1) From where would I know how to use the dll or create a object from it if I can’t read the .dll itself in Plaintext or any IDE?

You could do the following after you load the assembly:

$a = [appdomain]::CurrentDomain.GetAssemblies() | where codebase -like '*WebDriver.dll'
# List types from the WebDriver assembly
2) is there any other way to load a dll besides Add-Type -Path “C:\Temp\PSL\WebDriver.dll”?
Add-Type is the easiest and most recommended way that I have found.

Hey guys,

managed to collect some knowledge from the Selenium Module implementation.

Also I found a website which is explaining how to use the different classes of the DLL. Are those kind of documentations the only way to get that Info?

I learned now hot to work with the different classes but questions 1,2,3 are still unanswered to me.
best Regards, Marcel


Thanks for you reply, seems we send it at the same time. Will check :).

That was very helpful thanks.