Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.registerBasicAuth() not working in Edge browser #3848

Closed
ChristophMuth opened this issue Jul 31, 2023 · 4 comments
Closed

.registerBasicAuth() not working in Edge browser #3848

ChristophMuth opened this issue Jul 31, 2023 · 4 comments

Comments

@ChristophMuth
Copy link

Description of the bug/issue

When you create a new Nightwatch project and run a test in the Edge browser against a website that requires basic auth, it says that .registerBasicAuth() is only supported in Chromium based drivers.
As the Edge browser is Chromium based, I'd expect it to work the same way as when using Chrome.

Steps to reproduce

  1. Create a basic Nightwatch project with npm init nightwatch <directory-name>
  2. Write a basic test that navigates to a website protected with basic auth (see below)
  3. Download the Microsoft Edge WebDriver and add its location to the PATH
  4. Run the test
  5. See following error
Error
   The command .registerBasicAuth() is only supported in Chromium based drivers

Sample test

describe('basic auth test', function() {
  it('login via basic auth', function(browser) {
    browser
      .registerBasicAuth('username','password')
      .navigateTo('http://some-webpage-with-basic-auth')
      .waitForElementVisible('body')
      .assert.titleContains('some title')
      .end()
  });
});

Command to run

npx nightwatch --env edge test/sample.ts

Verbose Output

[basic auth test] Test Suite
────────────────────────────────────────────────────────
\ Starting EdgeDriver on port 9514...
[23072:26008:0731/195727.583:ERROR:chrome_browser_cloud_management_controller.cc(162)] Cloud management controller initialization aborted as CBCM is not enabled.

| Starting EdgeDriver on port 9514...
[23072:26008:0731/195727.732:ERROR:edge_auth_errors.cc(487)] EDGE_IDENTITY: Get Default OS Account failed: Error: Primary Error: kImplicitSignInFailure, Secondary Error: kAccountProviderFetchError, Platform error: 0, Error string: 
i Connected to EdgeDriver on port 9514 (608ms).
  Using: msedge (115.0.1901.188) on WINDOWS.


  Running login via basic auth:
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Error
   The command .registerBasicAuth() is only supported in Chromium based drivers
  √ Element <body> was visible after 38 milliseconds.
[23072:26008:0731/195730.338:ERROR:device_event_log_impl.cc(222)] [19:57:30.329] USB: usb_service_win.cc:415 Could not read device interface GUIDs: The system cannot find the specified file. (0x2)
  ✖ NightwatchAssertError

Nightwatch Configuration

module.exports = {
  src_folders: ['test','nightwatch'],
  page_objects_path: [],
  custom_commands_path: [],
  custom_assertions_path: [],
  plugins: [],
  globals_path: '',
  webdriver: {},
  test_workers: {
    enabled: true
  },
  test_settings: {
    default: {
      disable_error_log: false,
      launch_url: 'http://localhost',

      screenshots: {
        enabled: false,
        path: 'screens',
        on_failure: true
      },

      desiredCapabilities: {
        browserName: 'chrome'
      },
      
      webdriver: {
        start_process: true,
        server_path: ''
      },
    },
    
    edge: {
      desiredCapabilities: {
        browserName: 'MicrosoftEdge',
        'ms:edgeOptions': {
          w3c: true,
          args: []
        }
      },

      webdriver: {
        start_process: true,
        server_path: '',
        cli_args: [
        ]
      }
    },
  },
};

Nightwatch.js Version

3.1.2

Node Version

18.17.0

Browser

Edge 115.0.1901.188

Operating System

Windows 10

Additional Information

No response

@DenysLins
Copy link
Contributor

Hey guys, can I work on this bug?

@gravityvi
Copy link
Member

Hey @DenysLins 👋🏻 , You are most welcome to work on this. We have a check for edge browser but looks like you could also use MicrosoftEdge as browserName. We need to accommodate this in our code. You could also join our discord channel incase you need any help from us.

gravityvi pushed a commit that referenced this issue Aug 9, 2023
---------

Co-authored-by: Priyansh Garg <39924567+garg3133@users.noreply.github.com>
@DenysLins
Copy link
Contributor

Hey @gravityvi, who closes this issue?

@garg3133
Copy link
Member

Closing this as fixed in #3857. Thanks, @DenysLins!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants