Selenium Library with Chromium Edge Browser

Hi Team,

I am working on project which have to deal with new Microsoft chromium Edge Browser. I was not able to access the browser elements. Could any one help me unblocking this issue. Thanks in advance.

Last time I looked one needed to do few things:

  1. Install new Edge Chromium and the Edge chromium driver.
  2. Install Selenium 4, still in prerelease phase, but should work fine.
  3. Set use_chromium as True. Something like this should work:
    | Open Browser | url | edge | options=use_chromium=True |
1 Like

I am trying to use the above mentioned steps. But I am facing an error saying, “Options object has no attribute use_chromium”

That usually indicates that Selenium 4 is not installed. Execute pip list and verify the Selenium version. If 4.0 is not installed, do pip install -U --pre selenium

There is an alternate way for that in case you do not want to upgrade to Selenium4.
first Run msedgedriver.exe from the command line (i.e. msedgedriver.exe). It will start msedgedriver on port 9515 (you can choose port). Start the browser as given bellow.

| Open Browser | url | edge | remote_url=http://locahost:9515 |


I wrote a plugin that helps to use Edge Chromium with SeleniumLibrary & 3rd selenium, it uses [](http://Selenium Tools For Microsoft Edge) and no need to update the selenium to alpha version.
Think it could help you.

Tested versions:

  • robotframework==3.1.2
  • SeleniumLibrary ==4.3.0
  • selenium==3.141.0
  • MSEdgeDriver 84.0.524.0
  • msedge-selenium-tools==3.141.2

Usage of plugin:
Library SeleniumLibrary plugins=plugins.EdgePlugin
Open Browser ${URL} Edge options=use_chromium=True;headless=True

import importlib
from selenium import webdriver
from SeleniumLibrary import BrowserManagementKeywords
from SeleniumLibrary.utils import is_truthy, is_falsy
from SeleniumLibrary.keywords.webdrivertools import WebDriverCreator, SeleniumOptions
from msedge.selenium_tools import Edge as EdgePluginDriver

class EdgePlugin(BrowserManagementKeywords):
    This plugin is used to adapt SeleniumLibrary to run Edge browser
    (even chromium based version) with stable selenium version (3.141).
    It uses special msedge-selenium-tools
    that allows driving the new Microsoft Edge (Chromium) browser
    and use the latest functionality with no need to update to the alpha 4th selenium version.

    def __init__(self, ctx):
        BrowserManagementKeywords.__init__(self, ctx)
        self._webdriver_creator = _EdgePluginWebDriverCreator(self.log_dir)

class _EdgePluginWebDriverCreator(WebDriverCreator):
    def __init__(self, log_dir):
        self.log_dir = log_dir
        self.selenium_options = _EdgePluginSeleniumOptions()

    def create_edge(self, desired_capabilities, remote_url, options=None, service_log_path=None,
        if is_truthy(remote_url):
            defaul_caps = webdriver.DesiredCapabilities.EDGE.copy()
            desired_capabilities = self._remote_capabilities_resolver(
                desired_capabilities, defaul_caps)
            return self._remote(desired_capabilities, remote_url)
        if is_falsy(executable_path):
            executable_path = self._get_executable_path(EdgePluginDriver)
        return EdgePluginDriver(options=options,

class _EdgePluginSeleniumOptions(SeleniumOptions):

    def _import_options(self, browser):
        if browser == 'edge':
            options = importlib.import_module('msedge.selenium_tools.options')
            return options.Options
            return super(_EdgePluginSeleniumOptions, self)._import_options(browser)

@MrBIN89 Most appreciated, you saved us a lot of trouble :grinning:

1 Like

Hi MrBIN89,

I am relatively new to this, and I was wondering how to install your plugin to be able to use it with my robot scripts?
Do I need to include in a .py as a resource?

Thank you very much for the help!
Kind Regards,

Hey @oli129,

I ended up taking that code and implementing it here:

Some instructions on its use can be found at the bottom of this section here.

If you wanted to use it with base SeleniumLibrary you would need to copy that file somewhere your code could access and then do something like:

Library    SeleniumLibrary     plugins=Path.To.EdgePlugin

Open Browser    browser=Edge     options=use_chromium=True
1 Like

Hi @Wolfe1,

thank you very much for the quick input! I am looking into it now.
When trying to use the base Selenium library, with the following method Library SeleniumLibrary plugins=C:/SVN/ it throws the following error:

Initializing test library ‘SeleniumLibrary’ with arguments [ plugins=C:/SVN/ ] failed: Importing test library: ‘C:/SVN/’ failed.

So if that works you need to remove the ‘.py’ part at the end, and I would suggest naming the .py file to be the same as the class, ‘EdgePlugin’. Given I am not sure if thay path will work as it needs to be relative to the library import.

So with that said you would need to do something like:
Library | SeleniumLibrary | plugins=SVN.EdgePlugin

Otherwise if you want to use that library I linked it it extends SeleniumLibrary so you would be able to work simply by installing it and using:

Library | Zoomba.GUILibrary | plugins=Zoomba.Helpers.EdgePlugin

1 Like

Hi @Wolfe1,

thank you very much for the ideas! Both of your solutions worked out great! I was able to execute my test following your description!

Again, I do appreciate your help!

1 Like