florentbr / SeleniumBasic

A Selenium based browser automation framework for VB.Net, VBA and VBScript
BSD 3-Clause "New" or "Revised" License
421 stars 197 forks source link

I cannot set my default profile in Edge using Selenium in VBA #247

Open gremonfe opened 2 years ago

gremonfe commented 2 years ago

For some reason I cannot set my default profile in Edge using Selenium in VBA (Excel), tried with .SetProfile, with .AddArgument but it keeps generating a temporary profile.

With Chrome works though.

Did someone manage to make it work with Edge?

thanks

wolflash666 commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。 已经收到,等我看到了,立马回复。 

rufogil commented 2 years ago

I got my gastritis back trying to open Edge with the local profile. Yes, with Chrome works. I think it is a bug.

longvh211 commented 2 years ago

I was able to pull this off by adding the same ExtendCapabilities functions in the ChromeDriver.cs to the EdgeDriver.cs. After doing this, you just need to rebuild the solution and install. In VBA execution, the "user-data-dir" argument works as expected for Edge.

dantheinfoman commented 2 years ago

@longvh211 I'm getting lots of errors when I try to build even the original unedited solution. Can you share how you were able to do this?

Here's the errors I got: 1>------ Rebuild All started: Project: Selenium, Configuration: Debug Any CPU ------ 1> Selenium -> G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\bin\Debug\Selenium.dll 1> File not found - firefoxdriver.xpi 1> 0 File(s) copied 1> File not found - chromedriver.exe 1> 0 File(s) copied 1> File not found - operadriver.exe 1> 0 File(s) copied 1> File not found - iedriver.exe 1> 0 File(s) copied 1> File not found - iedriver64.exe 1> 0 File(s) copied 1> File not found - phantomjs.exe 1> 0 File(s) copied 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5258,5): error MSB3073: The command "xcopy /D /Y "G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\..\References\firefoxdriver.xpi" . 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5258,5): error MSB3073: xcopy /D /Y "G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\..\References\chromedriver.exe" . 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5258,5): error MSB3073: xcopy /D /Y "G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\..\References\operadriver.exe" . 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5258,5): error MSB3073: xcopy /D /Y "G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\..\References\iedriver.exe" . 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5258,5): error MSB3073: xcopy /D /Y "G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\..\References\iedriver64.exe" . 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(5258,5): error MSB3073: xcopy /D /Y "G:\excelvbaisfun\Complete Web Automation Excel VBA\SeleniumBasic-master\SeleniumBasic-master\Selenium\..\References\phantomjs.exe" ." exited with code 4. 2>------ Skipped Rebuild All: Project: Selenium.Tests, Configuration: Debug Any CPU ------ 2>Project not selected to build for this solution configuration 3>------ Skipped Rebuild All: Project: VbsConsole, Configuration: Debug Any CPU ------ 3>Project not selected to build for this solution configuration ========== Rebuild All: 0 succeeded, 1 failed, 2 skipped ==========

longvh211 commented 2 years ago

@dantheinfoman this is because there are files missing. You can have a look at my branch here in which I provided some instructions on rebuilding this.

By the way, if you are fire-fighting the June 15 event for a good method that can directly automate Chromium-based browsers or Edge IE Mode without installing another software, you can have a look at my StackOverflow reply here. I have prepared many helpful demo files in this article for us all to quickly get on board with these methods.