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

Can't run Chrome 127 - Error: WebSocket connection closed #8240

Closed
sam-yh opened this issue Jul 25, 2024 · 16 comments · Fixed by #8248
Closed

Can't run Chrome 127 - Error: WebSocket connection closed #8240

sam-yh opened this issue Jul 25, 2024 · 16 comments · Fixed by #8248
Labels
TYPE: bug The described behavior is considered as wrong (bug).

Comments

@sam-yh
Copy link

sam-yh commented Jul 25, 2024

What is your Scenario?

Since the update of Chrome to v.127, it can't be used with Testcafe anymore. Trying leads to the following error message:

ERROR Unable to open the "chrome:" browser due to the following error:
Error: WebSocket connection closed
    at /home/$USER/test_automation/node_modules/chrome-remote-interface/lib/chrome.js:94:35
    at Chrome._handleConnectionClose (/home/$USER/test_automation/node_modules/chrome-remote-interface/lib/chrome.js:256:13)
    at WebSocket.<anonymous> (/home/$USER/test_automation/node_modules/chrome-remote-interface/lib/chrome.js:243:22)
    at WebSocket.emit (node:events:519:28)
    at WebSocket.emit (node:domain:488:12)
    at WebSocket.emitClose (/home/$USER/test_automation/node_modules/ws/lib/websocket.js:246:10)
    at Socket.socketOnClose (/home/$USER/test_automation/node_modules/ws/lib/websocket.js:1148:15)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at TCP.<anonymous> (node:net:339:12)

Type "testcafe -h" for help.

What is the Current behavior?

Can't run Testcafe test files with Chrome version 127

What is the Expected behavior?

Being able to run Testcafe test files with Chrome version 127

What is the public URL of the test page? (attach your complete example)

https://testcafe.io/

What is your TestCafe test code?

import { Selector } from 'testcafe'

fixture`Bug Repro`.page`${'https://testcafe.io'}`

test('Bug Repro', async (t) => {
  await t.expect(Selector('.logo').exists).ok()
})

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. Have Chrome installed with version 127
  2. Run a test file with the given test code using Chrome 127

TestCafe version

3.6.2.

Node.js version

20.16.0

Command-line arguments

testcafe chrome test.js

Browser name(s) and version(s)

Chrome 127.0.6533.72

Platform(s) and version(s)

Ubuntu 22.04.3 LTS

Other

No response

@sam-yh sam-yh added the TYPE: bug The described behavior is considered as wrong (bug). label Jul 25, 2024
@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 25, 2024
@sam-yh
Copy link
Author

sam-yh commented Jul 25, 2024

Note that using --disable-native-automation does circumvent the WebSocket error. Though at least for us it doesn't really seem to be a true workaround, since with it we run into constant time-outs.
Also, not sure if in any way related, in that mode, Chrome seems to then always display a dialog for choosing a search engine.

@enriccarrion
Copy link

Hey @sam-yh , yes it's related to the search engine selection screen.
You can use --disable-search-engine-choice-screen to avoid it, it worked in my case and the WebSocket connection closed is gone.

@sam-yh
Copy link
Author

sam-yh commented Jul 25, 2024

Hi @enriccarrion - thanks! Though that doesn't seem to be an option that exists for Testcafe. At least I couldn't find any mention in the documentation or recent commits and it also unfortunately doesn't seem to have any effect for us.

@gforepsly
Copy link

gforepsly commented Jul 25, 2024

We are facing the same issue.

Running chrome with the next command works:
testcafe PATH_TO_TEST chrome --disable-search-engine-choice-screen

This is a chrome flag, but it works if provided with the browser.

Although this workaround works, it's not something we can use on our side. Will there be some kind of a fix?

@sam-yh
Copy link
Author

sam-yh commented Jul 25, 2024

Just in case anyone else has issues applying the workaround, I had to use it this way, for it to work:
testcafe chrome:--disable-search-engine-choice-screen PATH_TO_TEST

@enriccarrion
Copy link

Yes @sam-yh it's a chrome.exe flag, not a TestCafe flag.

@aleks-pro aleks-pro added STATE: Issue accepted An issue has been reproduced. and removed STATE: Need response An issue that requires a response or attention from the team. labels Jul 29, 2024
Copy link

We appreciate you taking the time to share information about this issue. We reproduced the bug and added this ticket to our internal task queue. We'll update this thread once we have news.

@orcwarrior
Copy link

Just in case anyone else has issues applying the workaround, I had to use it this way, for it to work: testcafe chrome:--disable-search-engine-choice-screen PATH_TO_TEST

Confirmed, I believe its correct order for testcafe args

@johndwz
Copy link

johndwz commented Jul 31, 2024

I had to apply it to the runner:
..
.browsers('chrome --window-size=1280,1024 --disable-search-engine-choice-screen')

Problem fixed for now.

Aleksey28 pushed a commit that referenced this issue Aug 2, 2024
…8248)

<!--
Thank you for your contribution.

Before making a PR, please read our contributing guidelines at

https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution

We recommend creating a *draft* PR, so that you can mark it as 'ready
for review' when you are done.
-->

## Purpose
_Describe the problem you want to address or the feature you want to
implement._

## Approach
_Describe how your changes address the issue or implement the desired
functionality in as much detail as possible._

## References
close #8240 

## Pre-Merge TODO
- [ ] Write tests for your proposed changes
- [ ] Make sure that existing tests do not fail
@vdedhia
Copy link

vdedhia commented Aug 15, 2024

Meanwhile how do I run it in headless mode ?
Or for a long term solution how does the .testcaferc.json file be updated ?

Coz when I am running through the command testcafe chrome:--disable-search-engine-choice-screen it is starting chrome instances. I have tried passing multiple parameters but to no avail.

@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 15, 2024
@sam-yh
Copy link
Author

sam-yh commented Aug 15, 2024

Meanwhile how do I run it in headless mode ? Or for a long term solution how does the .testcaferc.json file be updated ?

Coz when I am running through the command testcafe chrome:--disable-search-engine-choice-screen it is starting chrome instances. I have tried passing multiple parameters but to no avail.

Hey, for an individual command, you need to use " ", e.g. testcafe "chrome: --disable-search-engine-choice-screen" path/to/file

@vdedhia
Copy link

vdedhia commented Aug 15, 2024

Meanwhile how do I run it in headless mode ? Or for a long term solution how does the .testcaferc.json file be updated ?
Coz when I am running through the command testcafe chrome:--disable-search-engine-choice-screen it is starting chrome instances. I have tried passing multiple parameters but to no avail.

Hey, for an individual command, you need to use " ", e.g. testcafe "chrome: --disable-search-engine-choice-screen" path/to/file

Thanks for the reply, but this doesn't work as expected. It still starts chrome instances.
Command I used: testcafe "chrome: --disable-search-engine-choice-screen chrome:headless" PATH_TO_FILE

@sam-yh
Copy link
Author

sam-yh commented Aug 16, 2024

Meanwhile how do I run it in headless mode ? Or for a long term solution how does the .testcaferc.json file be updated ?
Coz when I am running through the command testcafe chrome:--disable-search-engine-choice-screen it is starting chrome instances. I have tried passing multiple parameters but to no avail.

Hey, for an individual command, you need to use " ", e.g. testcafe "chrome: --disable-search-engine-choice-screen" path/to/file

Thanks for the reply, but this doesn't work as expected. It still starts chrome instances. Command I used: testcafe "chrome: --disable-search-engine-choice-screen chrome:headless" PATH_TO_FILE

Ah sorry, I misread. I use testcafe "chrome:headless --disable-search-engine-choice-screen" path/to/file which works for me. Only call chrome once.

@vdedhia
Copy link

vdedhia commented Aug 16, 2024

Thanks, that worked like a charm 👍🏼

@Bayheck Bayheck removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 19, 2024
@gforepsly
Copy link

gforepsly commented Oct 18, 2024

As of Chrome 130.0.6723.59 using Node 20.17.0 the websocket closed error started to occur almost every time, again (even when using the mentioned flag in chrome).
Also, when browser starts, the test doesn't even want to maximizeWindow using beforeEach blocks (which was working up until now).

Anyone else experiencing the same issue?

Using MacOS 15.0.1

EDIT:
The workaround is to use Edge. It works even without the flag we mention inside of this thread.

Error: WebSocket connection closed at /node_modules/chrome-remote-interface/lib/chrome.js:94:35 at Chrome._handleConnectionClose (/node_modules/chrome-remote-interface/lib/chrome.js:256:13) at WebSocket.<anonymous> (/node_modules/chrome-remote-interface/lib/chrome.js:243:22) at WebSocket.emit (node:events:519:28) at WebSocket.emit (node:domain:488:12) at WebSocket.emitClose (/node_modules/chrome-remote-interface/node_modules/ws/lib/websocket.js:246:10) at Socket.socketOnClose (/node_modules/chrome-remote-interface/node_modules/ws/lib/websocket.js:1150:15) at Socket.emit (node:events:519:28) at Socket.emit (node:domain:488:12) at TCP.<anonymous> (node:net:339:12)

@Bayheck
Copy link
Collaborator

Bayheck commented Oct 21, 2024

Hello,

I believe you have encountered the following issue: #8286

We have released testcafe 3.7.0-rc.1 to address this issue.

Please take a look and let us know your results.

I would also like to ask you to create a separate issue ticket should you find a new issue by following this template:

https://github.com/DevExpress/testcafe/issues/new?assignees=&labels=TYPE%3A+bug&template=bug_report.yaml

@Bayheck Bayheck removed the STATE: Need response An issue that requires a response or attention from the team. label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants