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

CDP connection not getting reset across session when using Selenium. #3990

Closed
garg3133 opened this issue Jan 12, 2024 · 1 comment · Fixed by #3994
Closed

CDP connection not getting reset across session when using Selenium. #3990

garg3133 opened this issue Jan 12, 2024 · 1 comment · Fixed by #3994

Comments

@garg3133
Copy link
Member

Description of the bug/issue

When we run Nightwatch tests using Selenium, the CDP connection is not reset across different test suites, while it resets correctly when running tests with webdrivers directly.

This leads to the following error when using .registerBasicAuth() command:

Error   Error while running .registerAuth() protocol action: Cannot read properties of undefined (reading 'on') - /node_modules/selenium-webdriver/lib/webdriver.js:1356:24)

Steps to reproduce

  • Pick any two example tests and add the following test case to it:
    it('checking cdp connection', function (browser) {
       browser
         .registerBasicAuth('admin', 'admin')
         .navigateTo('https://the-internet.herokuapp.com/basic_auth')
         .pause(5000);
    });
  • Run them using selenium. (The second test will throw the above mentioned error.)
  • Run them using webdrivers directly. (Tests will run fine.)

Sample test

No response

Command to run

No response

Verbose Output

No response

Nightwatch Configuration

No response

Nightwatch.js Version

latest

Node Version

No response

Browser

No response

Operating System

No response

Additional Information

No response

@garg3133
Copy link
Member Author

Also, if we use .registerBasicAuth() in two different test cases (with different credentials) in the same test suite, the credentials passed to the second call will never get registered.

This can be solved by creating a new CDP connection everytime we call .registerBasicAuth().

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

Successfully merging a pull request may close this issue.

1 participant