Skip to content

[🐛 Bug]: edge in SELENIUM_BROWSER environment variable leads to web driver not building due to error #10218

@itsHusky

Description

@itsHusky

What happened?

I set up the environment variable SELENIUM_BROWSER, which includes the names of the browsers I want to run tests against. The values I use are the Browser names enumerated here. As far as I was experiencing, adding multiple browser names and seperating them by comma works fine. So, if I run tests against Firefox, Chrome and Opera, the value of the environment variable SELENIUM_BROWSER is firefox,chrome,opera. That works fine. However, as soon as I add edge to the environment variable, an error occurs as the web driver wasn't successfully built when trying to run the tests in Microsoft Edge. I also tried entering different names, such as MicrosoftEdge or msedge, but with no success.

However, when using an older selenium-webdriver version (4.0.0−beta.3), all tests run through.

Thank you in advance for looking into this. I couldn't figure out the source of the problem myself.

How can we reproduce the issue?

// I modified file google_search_test.js to this:

const { Browser, By, Key, until } = require('..')
const { ignore, suite } = require('../testing')

suite(function (env) {
  describe('Google Search', function () {
    let driver

    before(async function () {
      // env.builder() returns a Builder instance preconfigured for the
      // envrionment's target browser (you may still define browser specific
      // options if necessary (i.e. firefox.Options or chrome.Options)).
      driver = await env.builder()
         // When you call Builder#build(), all options irrelevant to the selected browser are dropped
        .setChromeOptions({acceptInsecureCerts: true})
        .setOperaOptions({acceptInsecureCerts: true})
        .setFirefoxOptions({acceptInsecureCerts: true})
        .setEdgeOptions({acceptInsecureCerts: true})
        .build()
    
        await driver.getCapabilities().then((caps) => console.log('caps', caps));
      })


    it('demo', async function () {
      await driver.get('https://www.google.com/ncr')
    })

    after(() => driver && driver.quit())
  })
})

Relevant log output

> node node_modules/mocha/bin/mocha -t 10000 node_modules/selenium-webdriver/example/google_search_test.js
[INFO] Running tests against [firefox, chrome, opera, MicrosoftEdge]

  [firefox]
    Google Search
      √ demo (1520ms)

  [chrome]
    Google Search
      √ demo (1405ms)

  [opera]
    Google Search
      √ demo (585ms)

  [MicrosoftEdge]
    Google Search
      1) "before all" hook for "demo"


  3 passing (10s)
  1 failing

  1) [MicrosoftEdge]
       Google Search
         "before all" hook for "demo":
     TypeError: Cannot read properties of undefined (reading 'apply')
      at Builder.builder.build (node_modules\selenium-webdriver\testing\index.js:291:59)
      at Context.<anonymous> (node_modules\selenium-webdriver\example\google_search_test.js:18:10)
      at processImmediate (node:internal/timers:464:21)

Operating System

Windows 10

Some more information about node, npm and mocha:

node -v
v16.13.1

npm -v
8.1.2

mocha (version 9.1.3)

Selenium version

4.1.0

What are the browser(s) and version(s) where you see this issue?

Microsoft Edge Version 96.0.1054.62 (Offizielles Build) (64-Bit)

What are the browser driver(s) and version(s) where you see this issue?

Version: 96.0.1054.62

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-nodejsJavaScript BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions