rosolko / WebDriverManager.Net

Automatic Selenium Webdriver binaries management for .Net
MIT License
269 stars 83 forks source link

VersionResolveStrategy.MatchingBrowser); -- Cannot implicitly convert type 'void' to 'string' #278

Closed DirkDiggler77 closed 1 year ago

DirkDiggler77 commented 1 year ago

Hello,

As of today I have about 20 Pipelines using the "VersionResolveStrategy.MatchingBrowser" Kicking back a Cannot implicitly convert type 'void' to 'string'. I also have a bunch more that can no longer Download or Find the newest ChromeDriver. These tests were running fine up until 09/26/2023 Started: Yesterday at 3:10 PM. This morning the ADO Pipelines all started to fail, and also fail when the code is run locally.

Thanks!

using WebDriverManager.DriverConfigs.Impl;
using WebDriverManager;
using Keys = OpenQA.Selenium.Keys;
using WebDriverManager.Helpers;

 public void StartBrowser()
        {

            /// Code below uses WebDriverManager Package, it will download the most current version of Chromedriver and use that.
            // This makes it so we are no longer ChromeDriver package dependent. No more updating ChromeDrivers per project

            // String to file latest Chrome Driver available
            string file = new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
            // path to ChromeDriver to be used
            string dir = System.IO.Path.GetDirectoryName(file);

            //Setting default download directory for Eagle file
            var chromeOptions = new ChromeOptions();

            var localDownloadDirectory = "C:\\Automation\\Selenium.Script.Assets\\DevAssetDownloads";

            chromeOptions.AddUserProfilePreference("download.default_directory", localDownloadDirectory);

            chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);

            driver = new ChromeDriver(dir, chromeOptions);
DirkDiggler77 commented 1 year ago

WebDriverManager is now making me fire a new Browser resolve session after each new [Test] is set and a browser needs to be opened. Do you have an ETA on this fix?

Thanks

  [Test]
        public void A_AddressesdownloadingAndUploadingBulkOps() //
        {

            string file = new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
            string dir = System.IO.Path.GetDirectoryName(file);
rosolko commented 1 year ago

At least this issue report required a full stack of error for first. Thanks

DirkDiggler77 commented 1 year ago

Here is a bit more info!!

So in the screenshot below! All the test in green A-F only fire to open the Browser once at the stating point A and they all pass. All the tests in Red A-E each open their own Browser session. The tests in Red never before needed each of their own Browser VersionResolveStrategy.MatchingBrowser) piece of code. They would just open the Browser which I'm guessing was still using the version from the Green passing test above.

Hope that makes sense!! Thanks for the help!

Microsoft Remote Desktop - Duanes PC 2023-09-28 at 9 22 13 AM

Microsoft Remote Desktop - Duanes PC 2023-09-28 at 9 58 58 AM

DirkDiggler77 commented 1 year ago

@rosolko Please go ahead and close this ticket for now! There is def something going on BUT I'm thinking it might be here on my side! Maybe something with the VS Project's in conjunction with something in ADO! I will re-open if needed.

Thanks!