'Powershell - MS Edge - Automation
Since IE11 is retiring soon, I was attempting to re-write my PS Scripts to automate MS Edge. I have searched online and apparently I need edgedriver_win64 and a WebDriver testing framework like Selenium 4. I have either got the links wrong or the logic wrong. But when I tried to install the driver, it just opened a command prompt saying "MSEdgeDriver was started successfully". Nothing was installed. And I have absolutely no idea of how to install Selenium 4. If someone could help me prep my PC so I can automate using MS Edge via PowerShell, I will be really grateful. Additionally some pointers on how to use these for automation via PowerShell will be big help.
Solution 1:[1]
The regular way to automate Edge with WebDriver is using C#, Python, Java like this doc, not PowerShell. If you really need to use PowerShell, you can use Selenium PowerShell Module. You can refer to the steps below:
- Run
Install-Module Selenium
in Windows PowerShell. - Download corresponding version of Edge WebDriver from here (same version as your Edge browser).
- Put the Edge WebDriver msedgedriver.exe into folder C:\Program Files\WindowsPowerShell\Modules\Selenium\3.0.1\assemblies (the path is where you install Selenium PowerShell Module, you can change it according to your real situation).
- Rename msedgedriver.exe to MicrosoftWebDriver.exe.
- Sample PowerShell code:
$Driver = Start-SeEdge Enter-SeUrl https://www.google.com -Driver $Driver
Solution 2:[2]
I use VBA in MSACCESS to open browser with power shell In Reference Libray in Database Selium Type Libray is selelcted Code below
Option Compare Database
Public Function EDGE_OPEN()
Set obj = CreateObject("Shell.Application")
obj.ShellExecute "microsoft-edge:https://www.google.com/"
End Function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Yu Zhou |
Solution 2 | Verto |