[🐛 Bug]: Critical issue: Cannot close a tab in latest FireFox 97.0
See original GitHub issueWhat happened?
I have a test that opens and closes several tabs.
After upgrading to Firefox 97.0, closing a tab fails with ConnectionFailedException
.
Apparently, Selenium 4.1.2 doesn’t support the CDP version of Firefox. But I don’t even want to use CDP! I just want to close the tab. 😦
org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:61974/devtools/browser/afce1689-e3ad-4cae-89c5-c1c0e38b65d8
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'Andreis-MacBook-Pro-2.local', ip: 'fe80:0:0:0:1c27:9d18:3512:9320%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_322'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:104)
at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:137)
at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:118)
at org.openqa.selenium.devtools.Connection.<init>(Connection.java:77)
at org.openqa.selenium.firefox.FirefoxDriver.maybeGetDevTools(FirefoxDriver.java:310)
at org.openqa.selenium.remote.RemoteWebDriver.close(RemoteWebDriver.java:440)
at integration.WebDriverConditionsTest.checkNumberOfOpenWindows(WebDriverConditionsTest.java:151)
How can we reproduce the issue?
public class FirefoxCdpTest {
public static void main(String[] args) {
WebDriverManager.firefoxdriver().setup();
FirefoxDriver driver = new FirefoxDriver();
driver.close();
}
}
Relevant log output
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Reading https://api.github.com/repos/mozilla/geckodriver/releases to seek geckodriver
[main] INFO io.github.bonigarcia.wdm.WebDriverManager - Exporting webdriver.gecko.driver as /Users/andrei/.cache/selenium/geckodriver/mac64/0.30.0/geckodriver
1644423218239 geckodriver INFO Listening on 127.0.0.1:57610
1644423218513 mozrunner::runner INFO Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "--marionette" "--remote-debugging-port" "59686" "-foreground" "-no-remote" "-profile" "/var/folders/dn/94xhn6fx70557vs13_5v0y8r0000gn/T/rust_mozprofileN99smV"
1644423219007 Marionette INFO Marionette enabled
2022-02-09 18:13:39.670 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSButton: 0x11ac0f000>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-02-09 18:13:39.671 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSButton: 0x120b5dc00>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-02-09 18:13:39.671 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSButton: 0x120b5d000>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-02-09 18:13:39.672 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSButton: 0x120b60400>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-02-09 18:13:39.673 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSButton: 0x120b5cc00>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-02-09 18:13:39.674 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x120b5bc00>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
2022-02-09 18:13:39.674 firefox-bin[95306:1849189] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x1190dd000>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /var/folders/dn/94xhn6fx70557vs13_5v0y8r0000gn/T/rust_mozprofileN99smV/search.json.mozlz4", (void 0)))
console.error: BackgroundUpdate:
_reasonsToNotScheduleUpdates: Failed to check for Maintenance Service Registry Key: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIUpdateProcessor.getServiceRegKeyExists]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: resource://gre/modules/BackgroundUpdate.jsm :: _reasonsToNotScheduleUpdates :: line 241" data: no]
DevTools listening on ws://localhost:59686/devtools/browser/12ee7271-550c-4ea0-a3cd-e2a9f4d9bf4a
1644423220856 Marionette INFO Listening on port 54788
1644423220889 RemoteAgent WARN TLS certificate errors will be ignored for this session
Feb 09, 2022 6:13:40 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
JavaScript error: chrome://remote/content/server/WebSocketHandshake.jsm, line 117: Error: The handshake request has incorrect Origin header http://localhost:59686
Feb 09, 2022 6:13:41 PM org.openqa.selenium.remote.http.WebSocket$Listener onError
WARNING: Invalid Status code=400 text=Bad Request
java.io.IOException: Invalid Status code=400 text=Bad Request
at org.asynchttpclient.netty.handler.WebSocketHandler.abort(WebSocketHandler.java:92)
at org.asynchttpclient.netty.handler.WebSocketHandler.handleRead(WebSocketHandler.java:118)
at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:314)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:435)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:750)
Exception in thread "main" org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:59686/devtools/browser/12ee7271-550c-4ea0-a3cd-e2a9f4d9bf4a
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'Andreis-MacBook-Pro-2.local', ip: 'fe80:0:0:0:1c27:9d18:3512:9320%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '1.8.0_322'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.http.netty.NettyWebSocket.<init>(NettyWebSocket.java:104)
at org.openqa.selenium.remote.http.netty.NettyWebSocket.lambda$create$3(NettyWebSocket.java:137)
at org.openqa.selenium.remote.http.netty.NettyClient.openSocket(NettyClient.java:118)
at org.openqa.selenium.devtools.Connection.<init>(Connection.java:77)
at org.openqa.selenium.firefox.FirefoxDriver.maybeGetDevTools(FirefoxDriver.java:310)
at org.openqa.selenium.remote.RemoteWebDriver.close(RemoteWebDriver.java:440)
at integration.FirefoxCdpTest.main(FirefoxCdpTest.java:16)
Process finished with exit code 1
Operating System
MacOS Monterey
Selenium version
4.1.2
What are the browser(s) and version(s) where you see this issue?
FireFox 97.0
What are the browser driver(s) and version(s) where you see this issue?
geckodriver 0.30.0
Are you using Selenium Grid?
no
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to configure Close Tab warnings in Firefox
Learn how to enable or disable the close tab warning that shows when you're about to close multiple tabs, in Firefox version 94...
Read more >Troubleshoot and diagnose Firefox problems - Mozilla Support
Some Firefox issues can be caused by a problem with one of the Firefox program files. Follow these steps to completely remove and...
Read more >Tab Issues and closing Tabs | Firefox Support Forum
Hi all, Super frustrating!! I have a few tabs open in Firefox, cant click the X to close them you have to really...
Read more >With several tabs I can't close the one I'm on. The "x" doesn't ...
Try Firefox Safe Mode to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons. (If you're...
Read more >Troubleshoot Firefox crashes (closing or quitting unexpectedly)
If the page stops working because part of the page has crashed or stopped responding, try reloading the page to see if that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The underlying issue is #10348 But I agree that shouldn’t break tests unrelated to devtools
I can duplicate this is an issue with Firefox 97 using Java but not Ruby, so I’ll have to see what is different as to why Firefox doesn’t like it. Firefox is still hard coded to use CDP v85, so the CDP version shouldn’t be the root cause.