question

moondaddy-8531 avatar image
0 Votes"
moondaddy-8531 asked TimonYang-MSFT commented

Selenium.WebDriver.3.141.0: 'EdgeOptions' does not contain a definition for 'UseChromium'

I have a a WPF, c#, .net 4.8, app using Selenium.WebDriver.MSEdgeDriver.

I built this 8 months ago when Edge was version was 88.x and to day I tried to run it and got errors saying that it could not find or was not compatible with version 88.x. So I went to nuget and upgraded:

Selenium.WebDriver.MSEdgeDriver to 91.0.864.37
and
Selenium.WebDriver to 3.141.0


Now the using: "using Microsoft.Edge.SeleniumTools;" was not recognized and I had to add: "using OpenQA.Selenium.Edge;"


Now for the code:

 var options = new EdgeOptions();
 options.UseChromium = true;
 options.Bin

I get compile errors on "UseChromium" and "BinaryLocation" as follows:


'EdgeOptions' does not contain a definition for 'UseChromium' and no accessible extension method 'UseChromium' accepting a first argument of type 'EdgeOptions' could be found (are you missing a using directive or an assembly reference?)


I googled this and found only a few items and they were not related.

==========================================================


A few easy steps to recreate this problem:

Using these instructions and the section “Using Selenium 4”:
https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/?tabs=c-sharp


  1. Create a new console app.


  2. Installation of Selenium libraries for C# can be done using NuGet:

Using package manager

Install-Package Selenium.WebDriver

  1. Add the reference to WebDriver in the project

And here you can see the error.
117540-image.png



In another project I used “Manage Nuget Packages” and installed these and still get the same problem.
117671-image.png


This should be really easy and it was no problem 8 months ago.


Any idea how I can get this straightened out?

Thanks.


dotnet-csharp
image.png (15.4 KiB)
image.png (11.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TimonYang-MSFT avatar image
0 Votes"
TimonYang-MSFT answered TimonYang-MSFT commented

Please try to modify the second nuget package to Microsoft.Edge.SeleniumTools.

It should be ok now.

117803-1.png


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1.png (8.9 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @TimonYang-MSFT. That did not help and gave me the new exception:

OpenQA.Selenium.WebDriverArgumentException

HResult=0x80131500
Message=invalid argument: no webview binary at
Source=WebDriver

I downloaded the new beta version of the webdriver which got me to the next issue:

packages\Selenium.WebDriver.4.0.0-beta4\lib\net48\WebDriver.dll

I get the time out error on this line now:

EdgeDriver edgeDriver = new EdgeDriver(edgeOptions);


Here's the exception.


OpenQA.Selenium.WebDriverException

HResult=0x80131500
Message=The HTTP request to the remote WebDriver server for URL http://localhost:8656/session timed out after 60 seconds.
Source=WebDriver



I googled this and found quite a few posts on this but nothing helped.


https://github.com/SeleniumHQ/selenium/issues/5457

https://seleniumjava.com/2019/09/02/solved-the-http-request-to-the-remote-webdriver-server-for-url-http-localhost52847-session-value-timed-out-after-60-seconds/


https://stackoverflow.com/questions/22322596/selenium-error-the-http-request-to-the-remote-webdriver-timed-out-after-60-sec

to name a few.





0 Votes 0 ·

Could you please show your existing complete code?
Let us reproduce your problem and test it.

0 Votes 0 ·
moondaddy-8531 avatar image
0 Votes"
moondaddy-8531 answered TimonYang-MSFT commented

Sure.

 class Program
 {
    
     /*
     ======================     SETUP STEPS    ======================
     Created a new .Net Framework Condole app v4.8
    
     1) Using these instructions:  https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/?tabs=c-sharp
    
     2) Downloaded msedgedriver.exe  Version 92.0.902.55
    
     3) Installed the WebDriver via this link:  https://www.nuget.org/packages/Selenium.WebDriver/4.0.0-beta4
    
     4) Added a project reference to   packages\Selenium.WebDriver.4.0.0-beta4\lib\net48\WebDriver.dll
    
     5) Copied the file msedgedriver.exe to the project root and set the property "Copy to output directory: Copy always"
    
     6) Added the code below and run the project
     */
    
     static void Main(string[] args)
     {
         Test1();
     }
    
     static void Test1()
     {
         EdgeOptions edgeOptions = new EdgeOptions();
         edgeOptions.UseChromium = true;
         edgeOptions.UseWebView = true;
         edgeOptions.BinaryLocation = @"D:\Apps\VSOCD\LeadaRator\Trunk\V01\zEdgeChromiumTest2\msedgedriver.exe";
    
         EdgeDriver edgeDriver = new EdgeDriver(edgeOptions);
         edgeDriver.Navigate().GoToUrl(@"https://www.salesgenie.com/sign-in/");
         Console.ReadKey();
     }
 }




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@moondaddy-8531
I tried all the solutions I could find, but I still couldn't solve this error.
I have no other suggestions now except to raise a new issue on Selenium's GitHub. I will continue to try to find a solution. If there are new discoveries, I will tell you immediately, hoping I can find useful content. :)

0 Votes 0 ·