Giter VIP home page Giter VIP logo

microsoft / edge-selenium-tools Goto Github PK

View Code? Open in Web Editor NEW
87.0 21.0 22.0 244 KB

An updated EdgeDriver implementation for Selenium 3 with newly-added support for Microsoft Edge (Chromium).

Home Page: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

License: Apache License 2.0

C# 49.92% Python 14.15% JavaScript 16.83% Java 19.10%
selenium webdriver edge dotnet python javascript automation testing edgehtml chromium

edge-selenium-tools's Introduction

DEPRECATED: Selenium Tools for Microsoft Edge

⚠️ This project is no longer maintained. Please uninstall Selenium Tools for Microsoft Edge and upgrade to Selenium 4 which has built-in support for Microsoft Edge (Chromium). For help upgrading your Selenium 3 browser tests to Selenium 4, see Selenium's guide here. ⚠️

This repository will remain available as an example, and for users that have not yet had a chance to upgrade. However, there will be no further activity on issues or pull requests. The @EdgeDevTools team will continue to work with the Selenium project to contribute future Microsoft Edge Driver features and bug fixes directly to Selenium 4.


Build Status

Selenium Tools for Microsoft Edge extends Selenium 3 with a unified driver to help you write automated tests for both the Microsoft Edge (EdgeHTML) and new Microsoft Edge (Chromium) browsers.

The libraries included in this project are fully compatible with Selenium's built-in Edge libraries, and run Microsoft Edge (EdgeHTML) by default so you can use our project as a seamless drop-in replacement. In addition to being compatible with your existing Selenium tests, Selenium Tools for Microsoft Edge gives you the ability to drive the new Microsoft Edge (Chromium) browser and unlock all of the latest functionality!

The classes in this package are based on the existing Edge and Chrome driver classes included in the Selenium project.

Before you Begin

Selenium Tools for Microsoft Edge was created as a compatibility solution for developers who have existing Selenium 3 browser tests and want to add coverage for the latest Microsoft Edge (Chromium) browser. The Microsoft Edge Developer Tools Team recommends using Selenium 4 instead because Selenium 4 has built-in support for Microsoft Edge (Chromium). If you are able to upgrade your existing tests, or write new tests using Selenium 4, then there is no need to use this package as Selenium should already have everything you need built in!

See Selenium's upgrade guide for help with upgrading from Selenium 3 to Selenium 4. If you are unable to upgrade due to a compatibility issues, please consider opening an issue in the official Selenium GitHub repo here. If you have determined that you cannot upgrade from Selenium 3 at this time, and would still like to add test coverage for Microsoft Edge (Chromium) to your project, see the steps in the section below.

Getting Started

Downloading Driver Executables

You will need the correct WebDriver executable for the version of Microsoft Edge you want to drive. The executables are not included with this package. WebDriver executables for all supported versions of Microsoft Edge are available for download here. For more information, and instructions on downloading the correct driver for your browser, see the Microsoft Edge WebDriver documentation.

Installation

Selenium Tools for Microsoft Edge depends on the official Selenium 3 package to run. You will need to ensure that both Selenium 3 and the Tools and included in your project.

C#

Add the Microsoft.Edge.SeleniumTools and Selenium.WebDriver packages to your .NET project using the NuGet CLI or Visual Studio.

JavaScript

npm install @microsoft/edge-selenium-tools

Java

Add msedge-selenium-tools-java to your project using Maven:

<dependencies>
    <dependency>
        <groupId>com.microsoft.edge</groupId>
        <artifactId>msedge-selenium-tools-java</artifactId>
        <version>3.141.0</version>
    </dependency>
</dependencies>

The Java package is also available for download on the Releases page.

Python

Use pip to install the msedge-selenium-tools and selenium packages:

pip install msedge-selenium-tools selenium==3.141

Example Code

See the Microsoft Edge WebDriver documentation for lots more information on using Microsoft Edge (Chromium) with WebDriver.

C#

using Microsoft.Edge.SeleniumTools;

// Launch Microsoft Edge (EdgeHTML)
var driver = new EdgeDriver();

// Launch Microsoft Edge (Chromium)
var options = new EdgeOptions();
options.UseChromium = true;
var driver = new EdgeDriver(options);

Java

Import EdgeDriver from the com.microsoft.edge.seleniumtools package to launch Microsoft Edge (Chromium). The com.microsoft.edge.seleniumtools package supports Chromium only. Use the official Selenium 3 package org.openqa.selenium.edge to launch EdgeHTML.

import com.microsoft.edge.seleniumtools.EdgeDriver;

// Launch Microsoft Edge (Chromium)
EdgeDriver driver = new EdgeDriver();

JavaScript

const edge = require("@microsoft/edge-selenium-tools");

// Launch Microsoft Edge (EdgeHTML)
let driver = edge.Driver.createSession();

// Launch Microsoft Edge (Chromium)
let options = new edge.Options().setEdgeChromium(true);
let driver = edge.Driver.createSession(options);

Python

from msedge.selenium_tools import Edge, EdgeOptions

# Launch Microsoft Edge (EdgeHTML)
driver = Edge()

# Launch Microsoft Edge (Chromium)
options = EdgeOptions()
options.use_chromium = True
driver = Edge(options = options)

Contributing

We are glad you are interested in automating the latest Microsoft Edge browser and improving the automation experience for the rest of the community!

Before you begin, please read & follow our Contributor's Guide. Consider also contributing your feature or bug fix directly to Selenium so that it will be included in future Selenium releases.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

edge-selenium-tools's People

Contributors

bwalderman avatar dependabot[bot] avatar guangyuexu avatar mastrzyz avatar microsoft-github-operations[bot] avatar microsoftopensource avatar punit-h avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edge-selenium-tools's Issues

[How To] [C#] Dynamically download Edge Webdriver

Hello,
This is not an issue but rather a way to dynamically download the correct Edge webdriver depending on what edge version is currently installed on your system.
I hope some of you might find this helpful.
The same can be donw for Mac OS and Linux. I just wanted to leave a bit of an inspiration.

public void DownloadEdgeDriver()
        {
            FileVersionInfo info = null;
            string version = null;
            string drivername = null;
            if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                if(!File.Exists(tmpfolder + "edgeversion.txt"))
                    File.Create(tmpfolder  + "edgeversion.txt").Close();

                if(Environment.Is64BitOperatingSystem is true)
                {
                    info = FileVersionInfo.GetVersionInfo(@"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe");
                    drivername = "edgedriver_win64.zip";
                }
                else
                {
                    info = FileVersionInfo.GetVersionInfo(@"C:\Program Files\Microsoft\Edge\Application\msedge.exe");
                    drivername = "edgedriver_win32.zip";
                }
                
                version = info.FileVersion;
                string current = File.ReadAllText(tmpfolder  + "edgeversion.txt").ToString();
                if (version != current)
                {
                    if(File.Exists(driverfolder + "\\*.zip"))
                        File.Delete(driverfolder  + "\\*.zip");
                    if(File.Exists(driverfolder  + "\\msedgedriver.exe"))
                        File.Delete(driverfolder  + "\\msedgedriver.exe");            
                    
                    using (var client = new WebClient()) 
                    {
                        client.DownloadFile("https://msedgedriver.azureedge.net/" + version + "/" + drivername, driverfolder  + "\\" + drivername);
                    }
                    if(File.Exists(driverfolder   + "\\msedgedriver.exe"))
                        File.Delete(driverfolder   + "\\msedgedriver.exe");
                    if(Directory.Exists(driverfolder   + "\\Driver_Notes"))
                        Directory.Delete(driverfolder   + "\\Driver_Notes", true);
                    ZipFile.ExtractToDirectory(driverfolder   + "\\" + drivername, Configuration.DefaultBinDirWin);
                    File.WriteAllText(tmpfolder + "edgeversion.txt", version);
                }
            }
        }

Cannot able to change the default download directory and browser closes after last command without quit command

My code is

from msedge.selenium_tools import Edge, EdgeOptions
from webdriver_manager.microsoft import EdgeChromiumDriverManager
import os, time

options = EdgeOptions()
# options.use_chromium = True
# options.add_argument("headless")
# options.add_argument("disable-gpu")
prefs = {'safebrowsing.enabled': 'false','download.default_directory' : os.getcwd() + os.path.sep}
options.add_experimental_option("prefs", prefs)
options.add_experimental_option("useAutomationExtension", False)

driver.get('https://github.com/')

Please help me on this
I want to run this on headless and download the files to a desired directory
especially from wher the code is triggered

C# edge remote driver error on selenium 4

Does anyone have any examples on how to use the Remote webdriver in C#?

So far i'm doing this:

new RemoteWebDriver(new Uri(RemoteEndPoint), options.ToCapabilities(), TimeSpan.FromMinutes(5))

It seems to work fine but when going on my Ubuntu docker container with edge installed I get this:

root@docker-desktop:/# java -jar standalone.jar node --publish-events tcp://x.x.x.x:4442 --subscribe-events tcp://x.x.x.x:4443
23:38:49.189 INFO [LoggingOptions.getTracer] - Using OpenTelemetry for tracing
23:38:49.190 INFO [LoggingOptions.createTracer] - Using OpenTelemetry for tracing
23:38:49.223 INFO [EventBusOptions.createBus] - Creating event bus: org.openqa.selenium.events.zeromq.ZeroMqEventBus
23:38:49.276 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://x.x.x.x:4442 and tcp://x.x.x.x:4443
23:38:49.307 INFO [UnboundZmqEventBus.<init>] - Sockets created
23:38:49.310 INFO [UnboundZmqEventBus.lambda$new$2] - Bus started
23:38:49.593 INFO [NodeServer.execute] - Reporting self as: http://x.x.x.x:5555
23:38:49.653 INFO [NodeOptions.report] - Adding Edge for {"browserName": "MicrosoftEdge"} 2 times
23:38:49.850 INFO [NodeServer.execute] - Started Selenium node 4.0.0-alpha-6 (revision 5f43a29cfc): http://x.x.x.x:5555
23:38:49.857 INFO [NodeServer.execute] - Starting registration process for node id 70381472-494c-476f-806b-03710e29ac2f
23:38:50.097 INFO [NodeServer.lambda$execute$0] - Node has been added
/msedgedriver: 1: Syntax error: ")" unexpected     (These errors are from the tests running)
/msedgedriver: 1: Syntax error: ")" unexpected     (These errors are from the tests running)

I'm not sure what I am doing wrong since I see the Python version seems to be a whole lot simpler.

Please add strong-naming to the assembilies inside the nuget package

Please produce strong-name signed assemblies as it makes the assemblies impossible to reference without modification by a project where strong-naming is enabled.

Selenium itself has a separate strong-named package (http://selenium-release.storage.googleapis.com/3.141/selenium-dotnet-strongnamed-3.141.0.zip). The better solution is to strong-name the assemblies and ship it in the existing package, because two packages that contain exactly the same assemblies, types, etc, could cause issues if they are in the same dependency graph.

Example of the current issue as seen in ILSpy:
Microsoft.Edge.SeleniumTools, Version=3.141.1.0, Culture=neutral, PublicKeyToken=null

Doesn't seem to work, and command line parameters don't seem to work either

This is my error:

Starting MSEdgeDriver 94.0.992.38 (55a0a486d5c4c1a7374dc28a7be702fee43b3b39) on port 1307 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe. MSEdgeDriver was started successfully.

DevTools listening on ws://127.0.0.1:1310/devtools/browser/c4e7f6f6-46d3-447c-b26b-3ad231a6122f [29296:584:1001/203949.853:ERROR:fallback_task_provider.cc(119)] Every renderer should have at least one task provided by a primary task provider. If a fallback task is shown, it is a bug. Please file a new bug and tag it as a dependency of crbug.com/739782. [29296:26032:1001/203954.115:ERROR:chrome_browser_main_extra_parts_metrics.cc(250)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends. [29296:584:1001/203954.143:ERROR:profile_manager.cc(1057)] Cannot create profile at path C:\Users\NibblyPig\AppData\Local\Microsoft\Edge\User Data\Default [29296:584:1001/203954.143:ERROR:profile_manager.cc(2010)] Cannot create profile at path C:\Users\NibblyPig\AppData\Local\Microsoft\Edge\User Data\Default [29296:26032:1001/203954.176:ERROR:chrome_browser_main_extra_parts_metrics.cc(254)] crbug.com/1216328: Checking default browser status ended.

From what I can ascertain from the scant information on google you need to pass an argument. There's not really any documentation on how to do this but I tried the following:

static void Main(string[] args)
{
    var options = new EdgeOptions();

    var capabilities = new List<string>() {
        "profile-directory=c:\\temp\\edgedriver\\temp",
        "user-data-dir=c:\\temp\\edgedriver\\temp"
    };

    options.AddAdditionalCapability("args", capabilities.ToArray());

    var driver = new EdgeDriver(@"c:\temp\edgedriver", options);

    driver.Url = "https://www.google.com";
}

However it doesn't seem to register the command line parameters at all, if I go to edge://version/

I'm just fumbling around in the dark as I see all kinds of things like references to a UseChromium flag that doesn't seem to exist, and if I don't provide the path to the executable (which incidentally has the wrong name in the zip) it gives me an exception that has a URL to get the edge driver from which is a broken link.

It may be that this entire project is just legacy/deprecated and not maintained and is broken as that's what it feels like, but if anyone knows how I can simply have a console app in .NET 4.7.2 that opens a browser and goes to google using Edge it would be appreciated.

unknown error: cannot find MSEdge binary

I set the executable path, it doesn't work
selenium 4
MSEdgeDriver 87.0.664.40
edge beta 87.0.664.40

$options.BinaryLocation = "C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe";

Cannot find MSEdge binary

Hello,
I'm trying to configure Microsoft Edge 89 node using Selenium JSON configuration.

Selenium: 3.141.59
Java: 1.8.1
OS: Windows 7 x64

Command to start a node:

java -Dwebdriver.edge.driver=driver\msedgedriver.exe -jar c:\selenium\selenium-server-standalone.jar -role node -nodeConfig node.json

node.json :

{
  "capabilities": [
    {
      "seleniumProtocol": "WebDriver",
      "browserName": "MicrosoftEdge",
      "version": "89",
      "platform": "WINDOWS",
      "maxInstances": 1,
      "edge_binary": "c:\\browsers\\edge-89\\msedge.exe"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": "12345",
  "register": true,
  "registerCycle": 5000,
  "hub": "http://localhost:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": true,
  "servlets": [],
  "withoutServlets": [],
  "custom": {}
}

I have also tried:

{
  "capabilities": [
    {
      "seleniumProtocol": "WebDriver",
      "browserName": "MicrosoftEdge",
      "version": "89",
      "platform": "WINDOWS",
      "maxInstances": 1,
      "ms:edgeChromium": true,
      "ms:edgeOptions": { "binary": "c:\\browsers\\edge-89\\msedge.exe" }
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": "12345",
  "register": true,
  "registerCycle": 5000,
  "hub": "http://localhost:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": true,
  "servlets": [],
  "withoutServlets": [],
  "custom": {}
}

Each time I'm getting unknown error: Cannot find MSEdge binary.

Could you help me with it?

Turn off remote debugging mode - MSEdge Driver - SAP Portal

I am trying to automate a SAP web portal (NetWeaver) using Selenium WebDriver 3.141.59 (Java binding). Upon navigating to the portal, it shows a message on screen saying "Could not open iView. The iView is not compatible with your browser, operating system, or device. Contact your system administrator for more information."

Also, on top it shows a ribbon with message "turn off remote debugging to open this site in internet explorer mode".

However, with regular browser session, it works fine.

Should I use any specific capabilities/option while creating EdgeDriver instance?

EdgeOptions is not CLS-compliant

Hi,

I get an error when trying to use EdgeOptions saying that it's not CLS-compliant. I couldn't find any flags explicitly turning the compliance off, and didn't notice anything when I looked at the class myself (it is rather large, though).

Is this at all intentional? I had to use #pragma warning disable CS3009 to derive from the class.

Best regards,
Stefan

Cannot create chromium EdgeDriver when using EdgeOptions to DesiredCapabilities

For example, test code like this.

Test code

from msedge.selenium_tools import Edge, EdgeOptions
options1 = EdgeOptions()
options1.use_chromium = True
print(options1.to_capabilities())
driver1 = Edge(options=options1)
options2 = EdgeOptions()
options2.use_chromium = True
print(options2.to_capabilities())
driver2 = Edge(desired_capabilities=options2.to_capabilities())

When I run this test code, I could check that two drivers have same capabilities, but driver2 is not created and it raise WebDriverException like this.

Log

Traceback (most recent call last):
File "C:/Users/Admin/PycharmProjects/Tissue Python/tests/test.py", line 9, in <module>
driver2 = Edge(desired_capabilities=options2.to_capabilities())
File "C:\Users\Admin\PycharmProjects\Tissue Python\venv\lib\site-packages\msedge\selenium_tools\webdriver.py", line 98, in __init__
self.service.start()
File "C:\Users\Admin\PycharmProjects\Tissue Python\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'MicrosoftWebDriver.exe' executable needs to be in PATH. Please download from http://go.microsoft.com/fwlink/?LinkId=619687

So, I look your webdriver.py source.

I think line no. 58 makes Edge Instance's options mandatory.

use_chromium = False
if options and options.use_chromium:
use_chromium = True

If options is None, use_chromium always has False.
So executable_path be 'MicrosoftWebDriver.exe'.

Could you check this issue?

Thank you.

How to disable SmartScreen (safebrowsing in edge) on C# Selenium Edge Chromium?

I'm using Microsoft.Edge.SeleniumTools EdgeOptions to construct options for the EdgeDriver.

But the issue right now is that Edge blocks downloads.

image

Tried different sorts of things but none of them worked.

Same issue can be solved on Chrome by disabling "safebrowsing" on UserProfilePreferences in ChromeOptions.

I know for a fact that SmartScreen does the blocking, if that is so is there any profile preference that I can use to disable SmartScreen ?

Or any other workaround to force download without the block would be very helpful.

Issues executing msedgedriver

I had reported this documentation issue
I have verified that I am using selenium driver version same as of browser version which is version 85.0.564.51
I am using Selenium.WebDriver:version 4.0.0-alpha05 and Selenium.Support version 4.0.0-alpha05

 var _driverExe = Path.Combine(${folderlocation}, ${exefilename});
//_driverExe = full exe location 
//C:\Users\Prateek\MiscExes\msedgedriver.exe

var options = new EdgeOptions
{
    UseChromium = true,
    BinaryLocation = _driverExe
};
var edgeDriver = new EdgeDriver(options);

It fails with

Exception thrown: 'OpenQA.Selenium.DriverServiceNotFoundException' in WebDriver.dll
The msedgedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/.
  1. If I copy msedgedriver.exe to my dotnet core console executable location i.e project/bin/Debug ; then
unknown error: MSEdge failed to start: was killed.
(unknown error: DevToolsActivePort file doesn't exist)
  1. If I copy msedgedriver.exe to my dotnet core console executable location i.e project/bin/Debug and setting binary location to msedge.exe location instead of driver exe location. But this doesnt respect DriverWait calls even though I set driver implicit wait time.
var options = new EdgeOptions 
{
    UseChromium = true,
    BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe",
};

var edgeDriver = new EdgeDriver(options);
edgeDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds (15);
var edgeWait = new WebDriverWait (edgeDriver, TimeSpan.FromSeconds (60));

edgeDriver.Navigate().GoToUrl("https://foobar.com");

var element = edgeWait.Until(d => d.FindElement (By.Name ("element_name")));
Exception thrown: 'OpenQA.Selenium.StaleElementReferenceException' in WebDriver.dll
stale element reference: element is not attached to the page document
  (Session info: MicrosoftEdge=85.0.564.51)

Host header or origin header is specified and is not whitelisted or localhost

I have a problem with msedgedriver, but I am not sure if this is right place to report it. If it is not, please redirect me to the proper issue tracker.

I'm experiencing the a problem in msedgedriver 92 and 93. It was working fine in msedgedriver 91 and before. It can be reproduced as follows:

  1. Start msedgedriver in Linux:
./msedgedriver --port=4444 --allowed-ips=''
  1. Connect to the URL: http://172.17.0.1:4444/

I need to use the IP 172.17.0.1 (instead of the usual localhost) since I run msedgedriver in a Docker container, and I need to request it using the IP address of the gateway between the Docker host and the bridge network (i.e., 172.17.0.1).

In msedgedriver 91, it works fine (i.e., the URL before can be requested normally). As of version 92, msedgedriver is not responding correctly. I get the following error in the msedgedriver traces:

Starting MSEdgeDriver 92.0.902.45 (ac0e90db3541aec3618593d9b9a1c1ce19757e48) on port 4444
All remote connections are allowed. Use an allowlist instead!
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping MSEdgeDriver safe.
MSEdgeDriver was started successfully.
[1626189763.900][SEVERE]: Rejecting request with host: 172.17.0.1:4444 address: 172.17.0.1

... and I get the following error in the client: Host header or origin header is specified and is not whitelisted or localhost.

I've tried to setup the whitelisted IPs (using the argument --whitelisted-ips='' when starting msedgedriver) but no luck. Any idea about it?

Does not support 83.

It looks like I cannot run this on Edge 83 and cannot find anywhere to download old version of Chromium Edge. I like to start using this package. Does anyone have a link to where you can get old version of Chromium Edge 81.

Python Edge driver; Cannot find MSEdge binary

Using the example code provided in the README, I receive the error WebDriverException: Message: unknown error: cannot find MSEdge binary

Edge version: Version 84.0.522.15 (Official build) beta (64-bit) (and corresponding webdriver)
Python version: 3.8
msedge-selenium-tools==3.141.1
selenium==3.141.0

Code to reproduce:

from msedge.selenium_tools import Edge, EdgeOptions

webdriver_location = "C:\\Path\\To\\msedgedriver.exe"

options = EdgeOptions()
options.use_chromium = True
driver = Edge(options=options, executable_path=webdriver_location)

My only thought is perhaps that this doesn't work with the beta build?

Please add java support as well for chromium Edge

Hi,
Thanks for creating this project , It really helps in running chromium edge tests with simple changes
Just wanted to know if there are any plans of adding java support as well, this will help a lot of selenium based frameworks.

Msedgedriver is having issues with Capybara when executed locally [ without Grid ]

Hi Respected Team,

I am running my test script using msedgedriver with ruby and capybara. Below are the version information.

  1. Platform : Windows 10
  2. capybara (3.35.3)
    addressable
    mini_mime (>= 0.1.3)
    nokogiri (> 1.8)
    rack (>= 1.6.0)
    rack-test (>= 0.6.3)
    regexp_parser (>= 1.5, < 3.0)
    xpath (
    > 3.2)
  3. rspec-expectations (3.10.1)
  4. selenium-webdriver (3.142.7)
  5. site_prism-all_there (0.3.2)
  6. ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
  7. Msedgedriver version 92 [ Stable ]
  8. Edge Browser version 92.0

This is how I am initializing my edge browser

Capybara.register_driver :selenium_edge do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.edge("javascriptEnabled": true,
"cssSelectorsEnabled": true,
"takesScreenshot": true,
"nativeEvents": true,
"rotatable": true,
'ms:edgeOptions' => { 'args' => [
"--disable-web-security"
], w3c: false })
Capybara::Selenium::Driver.new(app, browser: :edge,:driver_path => 'C:\Users\sum\Downloads\msedgedriver.exe',
desired_capabilities: capabilities)

Observation :-

  1. Driver loads the test url.
  2. NoMethodError: undefined method gsub' for nil:NilClass Stacktrace : - C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/capybara-3.35.3/lib/capybara/selenium/node.rb:18:in all_text'
    C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/capybara-3.35.3/lib/capybara/node/element.rb:60:in block in text' C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/capybara-3.35.3/lib/capybara/node/base.rb:83:in synchronize'
    C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/capybara-3.35.3/lib/capybara/node/element.rb:60:in `text'

Here chrome works fine. Here code is supposed to read text from webpage. Can you please let me know if this is an issue ?

expect(@app.login_page.logo_header.text).to eq('Text') works in chromedriver
expect(@app.login_page.logo_header.text).to eq('Text') not works in edgedriver
expect(@app.login_page.logo_header.native.text).to eq('Text') works in edgedriver

If I set up the Selenium gird and I use below code ,

Capybara.register_driver :selenium_grid do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.edge
Capybara::Selenium::Driver.new(app, browser: :remote, url: 'http://localhost:4444/wd/hub', desired_capabilities: capabilities)
end

Then edge driver works fine.

addcookie doesn't work with 90.0.818.46

After I updated from 89 to 90, the original code throws an exception.

OpenQA.Selenium.InvalidCookieDomainException:“invalid cookie domain: Cookie 'domain' mismatch
(Session info: MicrosoftEdge=90.0.818.46)”

With Edge browser 106.0.1370.61 observing timed out after 60 seconds exception and doesn't recover

I have automation where I have to put the device into sleep for some time and resume back and continue this is automated using C# Selenium with Edge chromium starting from version 106.0.1370.61 observing timed out after 60 seconds exception.

The HTTP request to the remote WebDriver server for URL http://localhost:51169/session/f4487276b9598848efffa4a8f69fd36a/actions timed out after 60 seconds.
11/5/2022 4:12:12 PM : Info: Wait for playback time 160000
the use case is:
run a video playback on edge -> put it in pause -> suspend device using auto sleep -> after resume ->wait for sleep time to get completed and resume script, issue is observed as soon as device enters sleep .

Unattended execution not working with Edge 93

I found that after updating Edge and the web driver to version 93.0.961.38 test execution in our build pipeline fails. With everything else unchanged (source code, build environment, OS) tests that completed last week are now failing. I am seeing ElementClickInterceptedExceptions and WebDriverTimeoutExceptions when expected content is not detected.

Tests run in Jenkins on a Windows Server machine. When running the tests interactively on my development computer and in a command prompt window on the server everything is fine.

Attempting to get a screenshot to figure out what's happening on the page results in

The HTTP request to the remote WebDriver server for URL http://localhost:62331/session/9ff5f2b91df1a9e969c42489aa96db86/screenshot timed out after 60 seconds.

What can I do to restore the functionality or to get to the root cause of the problem?

How can selenium hub differentiate EdgeHTML and Chrominum-based Edge nodes

Hello there,

I currently have one node with EdgeHTML and one node with chromium-based Microsoft Edge registered against the same selenium hub. I want to run some tests ONLY on EdgeHTML node.

My question is: how the hub can determine which node should be used due to that both nodes provide almost the same capability, i.e., browserName=MicrosoftEdge, platform=WIN10? The only difference is version. But it seems that the EdgeHTML driver doesn't allow to specify the version.

EdgeHTML Node capability:

  "capabilities":
  [
    {
      "browserName": "MicrosoftEdge",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver",
      "version": "18.17763"
    }
  ],

How I create the EdgeOptions:

var options = new EdgeOptions();
options.BrowserVersion = "18.17763";

EdgeHTML Node Log:

[16:34:52.002] - {
  "desiredCapabilities": {
    "browserName": "MicrosoftEdge",
    "browserVersion": "18.17763"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "MicrosoftEdge",
        "browserVersion": "18.17763"
      }
    ]
  }
}

[16:34:52.017] - Response: {"value":{"error":"invalid argument","message":"The specified arguments passed to the command are invalid.","stacktrace":""}}

[16:34:52.017] - Invalid capabilities 

Thanks.

Update for Selenium 4.0

Can we have a updated version for Selenium 4 please?

I'm getting the following error

Message:
System.MissingMethodException : Method not found: 'OpenQA.Selenium.Remote.DesiredCapabilities OpenQA.Selenium.DriverOptions.GenerateDesiredCapabilities(Boolean)'.
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
EdgeOptions.ToChromiumCapabilities()
EdgeOptions.ToCapabilities()
EdgeDriver.ConvertOptionsToCapabilities(EdgeOptions options, Boolean serviceUsingChromium)
EdgeDriver.ctor(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)
EdgeDriver.ctor(EdgeOptions options)
CallSite.Target(Closure , CallSite , Type , Object )
UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
Hooks.LaunchBrowser(ScenarioContext scenarioContext, FeatureContext featureContext) line 143
TestExecutionEngine.FireEvents(HookType hookType)
TestExecutionEngine.FireScenarioEvents(HookType bindingEvent)
TestExecutionEngine.OnScenarioStart()
TestExecutionEngine.OnAfterLastStep()
TestRunner.CollectScenarioErrors()

This was working fine on Selenium 3

Repo still required?

Hi Folks.

This week Selenium 4 was released to the world. A lot of the code in this repo appears to be workarounds for things that hadn't shipped.

I have done a quick look over the repo and I can't see it's needed and @bwalderman has submitted PRs to Selenium for similar functionality.

If this is no longer needed could we see about archiving this repository?

Cannot install Microsoft.Edge.SeleniumTools along custom built Selenium package

Somewhere along the version-line Chrome flipped the default for using the W3C protocol.
Since the Selenium C# API was still only passing in the override if it was overriding the previous default value, this meant there was no way to override any more.
See SeleniumHQ/selenium#7521.

In the end we build a version of the Selenium binaries ourselves with the right fix and packaged this in a local NuGet repo with version 3.141.1-w3c-flag.

This means we cannot install the Microsoft.Edge.SeleniumTools along this version, as it requires an exact match on 3.141.0.

I'd rather not compile and package this myself too, just for the sake of being able to install it.

Any suggestions on how to approach this? Could you relax the requirement for the exact match?

Execution of tests on remote host machine

Hello,
in our team we used chromedriver which executes UI test on embedded cefsharp browser on local and remote machines without any issues.
When we migrate into webview2 browser we switched from chromedriver to edgedriver but only tests which are running locally are successful.
Tests which require execution on remote machines gets this error when constructing edgedriver instance:
Message:

    OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:56777/session timed out after 60 seconds.
      ----> System.Net.WebException : The request was aborted: The operation has timed out.
    TearDown : System.ServiceModel.CommunicationObjectFaultedException : The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

we are using selenium v3 nuget package and MSEdgeDriver 91.0.864.37

Do you know what could be the problem?

the file MicrosoftWebDriver.exe doenst exist

when i try to run my test with this edge package i always get this error.
\bin\Debug\MicrosoftWebDriver.exe does not exist. The driver can be downloaded at http://go.microsoft.com/fwlink/?LinkId=619687.

i figure out, if a rename the "msedgedriver.exe" too "MicrosoftWebDriver.exe" in debug folder, the test run fine.

Unable to create service: EdgeDriverService

Trying to run msedge in a docker container as part of a selenium grid deployment, can't get the driver service to start and the error message just says that it can't start the service.

Code:

conn = EdgeRemoteConnection(remote_webdriver_url)
remote = webdriver.Remote(command_executor=conn, options=options)

Result of options.to_capabilities() :

{
  'browserName': 'MicrosoftEdge', 
  'version': '', 
  'platform': 'Linux',
  'ms:edgeOptions': {
    'extensions': [], 
    'binary': 'msedgedriver', 
    'args': ['--disable-infobars', '--disable-notifications', '--enable-automatic-password-saving', '--log-level=1', '--ignore-ssl- 
      errors=yes', '--ignore-certificate-errors']
}, 'ms:edgeChromium': True
}

Narrowing further, just calling .execute throws the same thing:
conn.execute('newSession', params={"desiredCapabilities": caps})

Versions:
selenium=3.141
driver=90.0.796.0

Any ideas?

How to run a new edge using webdriver.Remote ?

Hello,
I would like to open Edge browser on a remote server.
I have Seleniumin version 3.141.59 and Edge 81.0.416.7 (webdriver is appropriate for this version)
I use the following code written in python:

from msedge.selenium_tools import Edge, EdgeOptions
from msedge.selenium_tools.remote_connection import EdgeRemoteConnection
from selenium import webdriver

options = EdgeOptions()
options.use_chromium = True

command_executor = EdgeRemoteConnection('https://MY_HOST/wd/hub')
browser = webdriver.Remote(
    command_executor=command_executor,
    options=options
)

the browser opens but I get an error immediately, the selenium session is not created...

 File "/home/test/test/test/amazon/management/commands/selenium.py", line 40, in handle
    browser = webdriver.Remote(
  File "/home/test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/test/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unable to parse remote response: Unknown error
Stacktrace:
    at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:115)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession (ProtocolHandshake.java:74)
    at org.openqa.selenium.grid.session.remote.RemoteSession$Factory.performHandshake (RemoteSession.java:147)
    at org.openqa.selenium.grid.session.remote.ServicedSession$Factory.apply (ServicedSession.java:161)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.lambda$apply$12 (ActiveSessionFactory.java:180)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$11$1.accept (ReferencePipeline.java:442)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.Spliterators$ArraySpliterator.tryAdvance (Spliterators.java:958)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:150)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:543)
    at org.openqa.selenium.remote.server.ActiveSessionFactory.apply (ActiveSessionFactory.java:183)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$null$2 (NewSessionPipeline.java:66)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.Collections$2.tryAdvance (Collections.java:4747)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:150)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:543)
    at org.openqa.selenium.remote.server.NewSessionPipeline.lambda$createNewSession$3 (NewSessionPipeline.java:69)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.DistinctOps$1$2.accept (DistinctOps.java:174)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:195)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:177)
    at java.util.stream.Streams$StreamBuilderImpl.tryAdvance (Streams.java:397)
    at java.util.stream.Streams$ConcatSpliterator.tryAdvance (Streams.java:720)
    at java.util.stream.ReferencePipeline.forEachWithCancel (ReferencePipeline.java:127)
    at java.util.stream.AbstractPipeline.copyIntoWithCancel (AbstractPipeline.java:502)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:488)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
    at java.util.stream.FindOps$FindOp.evaluateSequential (FindOps.java:150)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.findFirst (ReferencePipeline.java:543)
    at org.openqa.selenium.remote.server.NewSessionPipeline.createNewSession (NewSessionPipeline.java:72)
    at org.openqa.selenium.remote.server.commandhandler.BeginSession.execute (BeginSession.java:65)
    at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0 (WebDriverServlet.java:235)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:830)

and logs from the selenium console:

Zaznaczenie_150

does anyone have any suggestions on what I am doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.