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

Use latest Firefox version with Selenium 2 on GitHub Actions #391

Closed
aik099 opened this issue Apr 8, 2024 · 26 comments · Fixed by #401
Closed

Use latest Firefox version with Selenium 2 on GitHub Actions #391

aik099 opened this issue Apr 8, 2024 · 26 comments · Fixed by #401

Comments

@aik099
Copy link
Member

aik099 commented Apr 8, 2024

The https://hub.docker.com/r/selenium/standalone-firefox image provided by Selenium only supports Firefox 47 when used with Selenium server 2.x versions. This causes problems in a test suite because a working code (e.g. dragging a div into itself in #359) fails due:

  • either outdated Firefox version
  • either outdated geckodriver version

Need to create an image with a modern Firefox/geckodriver version and use it on GitHub Actions.

@uuf6429
Copy link
Member

uuf6429 commented Nov 3, 2024

@aik099 @mvorisek @stof unfortunately, the request to update the firefox-se2 image was understandably not so successful.

I think I could be able make such a docker image with the pointers they provided, but that leaves a few open questions:

  1. do we really want to keep supporting Se2? Part of the reason to turn down the request is that all components are considered outdated and unsupported by the vendors (selenium, mozilla browser/driver..). Just want to point that out, I'm fine either way.
  2. where do we store the image? I'm thinking we could have a GH repo + workflow that generates and stores that image.
  3. this will impact docker-compose files and workflows that assume the image looks like `selenium/standalone-:``- they'll need to handle the first part as well, in this case.

@aik099
Copy link
Member Author

aik099 commented Nov 3, 2024

  1. What will be the file size of the built docker image?
  2. The BrowserStack use Selenium Server 2 by default. I guess we need to support Selenium 2.

@uuf6429
Copy link
Member

uuf6429 commented Nov 3, 2024

@aik099

  1. What will be the file size of the built docker image?

Probably at least 244mb - that's the current size of the image. That's well below GitHub's container registry limits.

  1. The BrowserStack use Selenium Server 2 by default. I guess we need to support Selenium 2.

Understood.


To answer your question from the other issue, my first thought is to create a new repo with just a workflow that generates and pushes such an image to the GitHub registry, which we can use later.
We could make this a bit more generic to allow adding more custom browser images - say opera or so, if we ever need that.

@aik099
Copy link
Member Author

aik099 commented Nov 4, 2024

That's good news. So GitHub has a place to store Docker images and we have image-building instructions from @SeleniumHQ. This way we can have mini-version of Selenium Docker images without our own tagging system.

Interesting sub-project.

Some docs I've found:
https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images - how to push container image to container registry upon release

Not sure if we should clone https://github.com/SeleniumHQ/docker-selenium/tree/trunk or do something else.

@aik099
Copy link
Member Author

aik099 commented Nov 5, 2024

I've playing around with Docker to see if I can manage to build an image using instructions from SeleniumHQ/docker-selenium#2454 (comment) .

The build succeeded with below patching instructions:

git clone [email protected]:SeleniumHQ/docker-selenium.git
cd docker-selenium
git checkout refs/tags/2.53.1-beryllium
make generate_all

# in the "NodeBase/Dockerfile.txt" add this line after 'ENV TZ "US/Pacific"'
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata

# in the "NodeFirefox/Dockerfile.txt" change
- firefox version to 88.0
- geckodriver version to 0.29.1

BUILD_ARGS="--platform linux/amd64" make standalone_firefox

Then you can create a container using just built image and don't forget to map 4444:4444 port in that container.

The selenium server in container does start, but when I attempt to operate on Firefox from it I'll get timeout error:

{"state":"unhandled error","sessionId":null,"hCode":1697088454,"value":{"localizedMessage":"Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:\nCrash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.02918) [GFX1-]: glxtest: libpci missing\nCrash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.02918) |[1][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=1.03006) [GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName\nCrash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.02918) |[1][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=1.03006) |[2][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=1.03007) [GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName\n\n(firefox:1296): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process \"dbus-launch\" (No such file or directory)\n","cause":null,"stackTrace":[{"fileName":"NewProfileExtensionConnection.java","nativeMethod":false,"methodName":"start","className":"org.openqa.selenium.firefox.internal.NewProfileExtensionConnection","hCode":-527404744,"lineNumber":112,"class":"java.lang.StackTraceElement"},{"fileName":"FirefoxDriver.java","nativeMethod":false,"methodName":"startClient","className":"org.openqa.selenium.firefox.FirefoxDriver","hCode":-396788057,"lineNumber":271,"class":"java.lang.StackTraceElement"},{"fileName":"RemoteWebDriver.java","nativeMethod":false,"methodName":"<init>","className":"org.openqa.selenium.remote.RemoteWebDriver","hCode":2001602299,"lineNumber":119,"class":"java.lang.StackTraceElement"},{"fileName":"FirefoxDriver.java","nativeMethod":false,"methodName":"<init>","className":"org.openqa.selenium.firefox.FirefoxDriver","hCode":2005391575,"lineNumber":218,"class":"java.lang.StackTraceElement"},{"fileName":"FirefoxDriver.java","nativeMethod":false,"methodName":"<init>","className":"org.openqa.selenium.firefox.FirefoxDriver","hCode":2005391568,"lineNumber":211,"class":"java.lang.StackTraceElement"},{"fileName":"FirefoxDriver.java","nativeMethod":false,"methodName":"<init>","className":"org.openqa.selenium.firefox.FirefoxDriver","hCode":2005391486,"lineNumber":129,"class":"java.lang.StackTraceElement"},{"fileName":"NativeConstructorAccessorImpl.java","nativeMethod":true,"methodName":"newInstance0","className":"sun.reflect.NativeConstructorAccessorImpl","hCode":-917798116,"lineNumber":-2,"class":"java.lang.StackTraceElement"},{"fileName":"NativeConstructorAccessorImpl.java","nativeMethod":false,"methodName":"newInstance","className":"sun.reflect.NativeConstructorAccessorImpl","hCode":-1864225098,"lineNumber":62,"class":"java.lang.StackTraceElement"},{"fileName":"DelegatingConstructorAccessorImpl.java","nativeMethod":false,"methodName":"newInstance","className":"sun.reflect.DelegatingConstructorAccessorImpl","hCode":-2122307259,"lineNumber":45,"class":"java.lang.StackTraceElement"},{"fileName":"Constructor.java","nativeMethod":false,"methodName":"newInstance","className":"java.lang.reflect.Constructor","hCode":-1319859919,"lineNumber":423,"class":"java.lang.StackTraceElement"},{"fileName":"FirefoxDriverProvider.java","nativeMethod":false,"methodName":"callConstructor","className":"org.openqa.selenium.remote.server.FirefoxDriverProvider","hCode":380089712,"lineNumber":91,"class":"java.lang.StackTraceElement"},{"fileName":"FirefoxDriverProvider.java","nativeMethod":false,"methodName":"newInstance","className":"org.openqa.selenium.remote.server.FirefoxDriverProvider","hCode":-616843598,"lineNumber":68,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultDriverFactory.java","nativeMethod":false,"methodName":"newInstance","className":"org.openqa.selenium.remote.server.DefaultDriverFactory","hCode":-1365021416,"lineNumber":60,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultSession.java","nativeMethod":false,"methodName":"call","className":"org.openqa.selenium.remote.server.DefaultSession$BrowserCreator","hCode":2056168471,"lineNumber":222,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultSession.java","nativeMethod":false,"methodName":"call","className":"org.openqa.selenium.remote.server.DefaultSession$BrowserCreator","hCode":2056168250,"lineNumber":1,"class":"java.lang.StackTraceElement"},{"fileName":"FutureTask.java","nativeMethod":false,"methodName":"run","className":"java.util.concurrent.FutureTask","hCode":-820313554,"lineNumber":266,"class":"java.lang.StackTraceElement"},{"fileName":"DefaultSession.java","nativeMethod":false,"methodName":"run","className":"org.openqa.selenium.remote.server.DefaultSession$1","hCode":-255143467,"lineNumber":176,"class":"java.lang.StackTraceElement"},{"fileName":"ThreadPoolExecutor.java","nativeMethod":false,"methodName":"runWorker","className":"java.util.concurrent.ThreadPoolExecutor","hCode":-1285150177,"lineNumber":1149,"class":"java.lang.StackTraceElement"},{"fileName":"ThreadPoolExecutor.java","nativeMethod":false,"methodName":"run","className":"java.util.concurrent.ThreadPoolExecutor$Worker","hCode":-242190638,"lineNumber":624,"class":"java.lang.StackTraceElement"},{"fileName":"Thread.java","nativeMethod":false,"methodName":"run","className":"java.lang.Thread","hCode":-82946317,"lineNumber":748,"class":"java.lang.StackTraceElement"}],"suppressed":[],"message":"Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:\nCrash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.02918) [GFX1-]: glxtest: libpci missing\nCrash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.02918) |[1][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=1.03006) [GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName\nCrash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.02918) |[1][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=1.03006) |[2][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=1.03007) [GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName\n\n(firefox:1296): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process \"dbus-launch\" (No such file or directory)\n","hCode":1762811064,"class":"org.openqa.selenium.firefox.NotConnectedException","screen":null},"class":"org.openqa.selenium.remote.Response","status":13}

The error suggests, that I haven't properly matched Selenium Server to the Geckodriver version and Firefox version (as said in https://www.edureka.co/community/5548/unable-to-connect-to-host-127-0-0-1-on-port-7055-after-45000-ms ).

The same thing happens if I try to use --headless flag in the desired capabilities.


A super easy reproduction example would be to create this Dockerfile in an empty folder:

FROM selenium/standalone-firefox:2.53.1-beryllium

USER root

RUN apt-get update

And then run docker build --platform=linux/amd64 . in that folder.

This will get you the most recent Firefox version (88.0), that is compatible with this os. Probably I need to install something to make it work, but I have no idea what exactly.

@uuf6429
Copy link
Member

uuf6429 commented Nov 5, 2024

Sorry to hear it didn't work out, but good to see some progress nevertheless.

What confuses me in your (final) instructions is that it seems to upgrade firefox after running apt-get update... surely that can't be right? 🤔

@aik099
Copy link
Member Author

aik099 commented Nov 6, 2024

Sorry to hear it didn't work out, but good to see some progress nevertheless.

It's work in progress. At least it's not a compilation error, that I saw at beginning.

What confuses me in your (final) instructions is that it seems to upgrade firefox after running apt-get update... surely that can't be right? 🤔

What is wrong wrong with this? You mean we're not controlling what Firefox version is used and getting the latest compatible to the OS?

Did another try to build an image with same Firefox/geckodriver versions as it's supposed to be built. It doesn't work either, but the error is different:

Could not open connection: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
XPCOMGlueLoad error for file /opt/firefox-47.0.1/libxul.so:
libasound.so.2: cannot open shared object file: No such file or directory
Couldn't load XPCOM.

Now I've tried looking at the build warnings I've received and turned out some of Dockerfile syntax (like ENV var_name var_value) is deprecated, but in reality it simply has no effect. After fixing it and adding couple of missing packages (instructions below) I've managed to get original image to build (with old firefox version):

git clone [email protected]:SeleniumHQ/docker-selenium.git
cd docker-selenium
git checkout refs/tags/2.53.1-beryllium
make generate_all

# replaced "ENV var_name var_value" into "ENV var_name=var_value" in these files:
#- NodeBase/Dockerfile.txt
#- NodeFirefox/Dockerfile.txt

# in the "Base/Dockerfile" added "libasound2 \" (on a new line) after "wget \"
# in the "Base/Dockerfile" added "tzdata \" (on a new line) after "libasound2 \"

# in the "NodeFirefox/Dockerfile.txt" change (still experimenting what versions will work)
- firefox version to 130.0 or 88.0.1
- geckodriver version to 0.35.0 or 0.29.1

VERSION="2.53.1-custom"  BUILD_ARGS="--platform linux/amd64" make standalone_firefox

@aik099
Copy link
Member Author

aik099 commented Nov 6, 2024

(Selenium 2) Firefox 88.0.1 and GeckoDriver 0.29.1 on 2.53.1-beryllium

Results with Firefox 88.0.1 and GeckoDriver 0.29.1 (actually used by Selenium 4 image: https://hub.docker.com/layers/selenium/standalone-firefox/88.0.1-geckodriver-0.29.1-20210513/images/sha256-84603a539c99ceb2ece196f0e6c4c7665b9b11bf6d48d4bd9e0015f694b50d58 ):

From Docker container logs:

...
2024-11-06 07:14:43 21:14:43.648 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
2024-11-06 07:14:43 21:14:43.649 INFO - Selenium Server is up and running
2024-11-06 07:14:51 21:14:51.796 INFO - Executing: [new session: Capabilities [{name=Behat Test, browserName=firefox, moz:firefoxOptions={args=[--headless, --width=1550, --height=1160]}}]])
2024-11-06 07:14:51 21:14:51.806 INFO - Creating a new session for Capabilities [{name=Behat Test, browserName=firefox, moz:firefoxOptions={args=[--headless, --width=1550, --height=1160]}}]
2024-11-06 07:15:37 org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
2024-11-06 07:15:37 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.847796) [GFX1-]: glxtest: libpci missing
2024-11-06 07:15:37 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.847796) |[1][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=0.848925) [GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName
2024-11-06 07:15:37 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=0.847796) |[1][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=0.848925) |[2][GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName (t=0.849143) [GFX1-]: glxtest: libEGL missing eglGetDisplayDriverName
...

(Selenium 2) Firefox 132.0.1 and GeckoDriver 0.35.0 on 3.141.59-zirconium

I've also tried using 3.141.59-zirconium tag and replaced Selenium Server version used. The commands are as follows:

git clone [email protected]:SeleniumHQ/docker-selenium.git
cd docker-selenium
git checkout refs/tags/3.141.59-zirconium

# in the "Base/Dockerfile" replaced "https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar" with "https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar"

# in "Standalone/start-selenium-standalone.sh" file replace the

java ${JAVA_OPTS} -cp ${JAVA_CLASSPATH:-"/opt/selenium/*:."} org.openqa.grid.selenium.GridLauncherV3 \
    ${SE_OPTS}

with

java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
    ${SE_OPTS}

# in "NodeFirefox/Dockerfile.txt" replace "0.26.1" to "0.35.0"

This gives a bit different error, but problem is the same (glxtest: libpci missing and glxtest: libEGL missing) from Docker container logs :

2024-11-06 08:02:57 06:02:57.905 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
2024-11-06 08:02:57 06:02:57.905 INFO - Selenium Server is up and running
2024-11-06 08:03:24 06:03:24.467 INFO - Executing: [new session: Capabilities [{name=Behat Test, browserName=firefox, moz:firefoxOptions={args=[--headless, --width=1550, --height=1160]}}]])
2024-11-06 08:03:24 06:03:24.477 INFO - Creating a new session for Capabilities [{name=Behat Test, browserName=firefox, moz:firefoxOptions={args=[--headless, --width=1550, --height=1160]}}]
2024-11-06 08:04:09 org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
2024-11-06 08:04:09 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.09012) [GFX1-]: glxtest: libpci missing
2024-11-06 08:04:09 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=1.09012) |[1][GFX1-]: glxtest: libEGL missing (t=1.09112) [GFX1-]: glxtest: libEGL missing
2024-11-06 08:04:09 [Parent 101, Main Thread] WARNING: Failed to create DBus proxy for org.a11y.Bus: Address element “/dev/null” does not contain a colon (:)
2024-11-06 08:04:09 : 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 08:04:09 
2024-11-06 08:04:09 ** (firefox:101): WARNING **: 06:03:26.391: Failed to create DBus proxy for org.a11y.Bus: Address element “/dev/null” does not contain a colon (:)
...

(Selenium 3) Firefox 132.0.1 and GeckoDriver 0.35.0 on 3.141.59-zirconium

Both errors exist in the official selenium/standalone-firefox:3.141.59 image but in there this doesn't cause any issues and I see these Docker logs:

...
2024-11-06 09:29:10 2024-11-06 07:29:10,255 INFO spawned: 'selenium-standalone' with pid 11
2024-11-06 09:29:10 07:29:10.893 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
2024-11-06 09:29:10 2024-11-06 07:29:10,894 INFO success: xvfb entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-11-06 09:29:10 2024-11-06 07:29:10,894 INFO success: selenium-standalone entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2024-11-06 09:29:10 07:29:10.983 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2024-11-06 09:29:11 2024-11-06 07:29:11.022:INFO::main: Logging initialized @708ms to org.seleniumhq.jetty9.util.log.StdErrLog
2024-11-06 09:29:11 07:29:11.219 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
2024-11-06 09:29:11 07:29:11.353 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
2024-11-06 09:29:22 07:29:22.775 INFO [ActiveSessionFactory.apply] - Capabilities are: {
2024-11-06 09:29:22   "browserName": "firefox",
2024-11-06 09:29:22   "name": "Behat Test"
2024-11-06 09:29:22 }
2024-11-06 09:29:22 07:29:22.777 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
2024-11-06 09:29:22 1730878162817       geckodriver     INFO    Listening on 127.0.0.1:26148
2024-11-06 09:29:23 1730878163095       mozrunner::runner       INFO    Running command: "/usr/bin/firefox" "--marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileuPJdBP"
2024-11-06 09:29:24 [GFX1-]: glxtest: libpci missing
2024-11-06 09:29:24 [GFX1-]: glxtest: libEGL missing
2024-11-06 09:29:24 1730878164239       Marionette      INFO    Marionette enabled
2024-11-06 09:29:25 console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofileuPJdBP/search.json.mozlz4", (void 0)))
2024-11-06 09:29:26 1730878166099       Marionette      INFO    Listening on port 33909
2024-11-06 09:29:26 07:29:26.223 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C
2024-11-06 09:29:26 07:29:26.255 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session c668df77-05f9-4e2c-9da1-015a32c3d845 (org.openqa.selenium.firefox.GeckoDriverService)
...

Since Selenium Server 2 can talk with the latest Firefox and the latest geckodriver I don't understand why it doesn't when used in a Docker container.

(Selenium 2) Firefox 132.0 and Geckodriver 0.35.0 on 2.53.1-beryllium

Docker logs using debug image:

2024-11-06 11:26:45 org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
2024-11-06 11:26:45 olkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_state: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_state: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_background_color: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_background_color: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_color: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_color: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_widget_get_style_context: assertion 'GTK_IS_WIDGET (widget)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_state: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_state: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 [Parent 134, Main Thread] WARNING: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed: 'glib warning', file /builds/worker/checkouts/gecko/toolkit/xre/nsSigHandlers.cpp:187
2024-11-06 11:26:45 
2024-11-06 11:26:45 (firefox:134): Gtk-CRITICAL **: gtk_style_context_get_property: assertion 'GTK_IS_STYLE_CONTEXT (context)' failed
2024-11-06 11:26:45 Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libEGL missing methods for GL test (t=0.968291) [GFX1-]: glxtest: libEGL missing methods for GL test
2024-11-06 11:26:45 
2024-11-06 11:26:45     at ...
...

While connected via VNC I've seen, that Selenium does start Firefox and then does nothing for 45 seconds and then closes firefox (or firefox crashes).

⚠️ The [...](glxtest: libpci missing) error can be solved with sudo apt-get install pciutils command, but I wasn't able to figure out what package needs to be installed to fix the glxtest: libEGL missing error.

@stof
Copy link
Member

stof commented Nov 6, 2024

another option is to stop using a docker image for that in our CI process, installing Selenium and Firefox separately in the GHA runner (and Firefox is even pre-installed in the runner image: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#browsers-and-drivers)

@aik099
Copy link
Member Author

aik099 commented Nov 6, 2024

another option is to stop using a docker image for that in our CI process, installing Selenium and Firefox separately in the GHA runner (and Firefox is even pre-installed in the runner image: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#browsers-and-drivers)

We did that in the past (in Travis CI times). I don't remember why we've decided to abandon that approach in favor of a selenium Docker image.

@stof
Copy link
Member

stof commented Nov 6, 2024

I think we did that in GHA because it was simpler to setup (but this is simpler only as long as we have maintained images)

@uuf6429
Copy link
Member

uuf6429 commented Nov 6, 2024

installing Selenium and Firefox separately in the GHA runner

You know that the runner is basically docker? You can just copy&paste those commands into a new Dockerfile and we're ready to go.

The selenium repo setup might have been nice if it was quick and fast, but it turns out it isn't. That doesn't mean we throw away all (selenium) images and docker even, just because of that.

I don't remember why we've decided to abandon that approach

Uhm, let's see...

  1. because it works differently than local, even if you happen to be using linux
  2. it's very slow to set up
  3. it's impossible to share between devs... it might work on macs, but it won't on windows ('coz who cares about those devs, right?)
  4. it's extremely high maintenance... some package firefox depends on changes and suddenly you're building libxxxxx manually
  5. you're forced to be a browser expert...firefox needs this and that, opera needs that other thing etc
  6. setting up a matrix is a breeze, you just fill in the browser name/version and you're done

@aik099
Copy link
Member Author

aik099 commented Nov 6, 2024

If Selenium 2/3 won't work on the latest GitHub Actions machine, then we're forced to stay with Docker.

Here is the summary of my reanimation experiments on Selenium 2 Docker images:

  • they are pretty fragile (you only need to update Firefox above 49.0.2 version and everything stops working)
  • Firefox itself opens just fine (tested via VNC)
  • when Selenium 2 (either installed on 3.141.59-zirconium or used from 2.53.1-beryllium) attempts to control Firefox it only is able to start it and freeze for 45 seconds without the ability to control it; then Firefox closes by itself

I even was able to run Selenium 3 inside a 2.53.1-beryllium container without issues. Maybe I need Java > 1.8.0, that is available on Ubuntu 16 being used?

@uuf6429 , any idea how to overcome this problem?

@uuf6429
Copy link
Member

uuf6429 commented Nov 6, 2024

@aik099 I'm sorry I didn't have time yet to deep dive into this.

Yesterday I tried a simple dockerfile (based on your short example above) and was trying to analyse the last layer (apt-get update), but the usual tools I use both failed (dive is quite broken (and apparently abandoned) and PhpStorm/IDEA is also currently broken 🤦).^

I'm well aware of Docker's advantages - it's a far cry from vagrant and pre-built VMs, but it's also not the most polished tool out there. I deeply resent that, especially the way they treat their users, but I'm not aware of a good alternative.

@aik099
Copy link
Member Author

aik099 commented Nov 7, 2024

@uuf6429 , were you able to get Docker image build with latest Firefox and Selenium 2 and see these errors?

Here is latest patch to be applied over 2.53.1-beryllium tag:

diff --git a/Base/Dockerfile b/Base/Dockerfile
index 7d326cf6..05a3d5ff 100644
--- a/Base/Dockerfile
+++ b/Base/Dockerfile
@@ -20,6 +20,10 @@ RUN apt-get update -qqy \
     sudo \
     unzip \
     wget \
+    libasound2 \
+    tzdata \
+    pciutils \
+    libglu1-mesa-dev \
   && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
   && sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security
 
diff --git a/Hub/Dockerfile.txt b/Hub/Dockerfile.txt
index 99295231..828004d0 100644
--- a/Hub/Dockerfile.txt
+++ b/Hub/Dockerfile.txt
@@ -6,14 +6,16 @@ MAINTAINER Selenium <[email protected]>
 
 EXPOSE 4444
 
-ENV GRID_NEW_SESSION_WAIT_TIMEOUT -1
-ENV GRID_JETTY_MAX_THREADS -1
-ENV GRID_NODE_POLLING  5000
-ENV GRID_CLEAN_UP_CYCLE 5000
-ENV GRID_TIMEOUT 30000
-ENV GRID_BROWSER_TIMEOUT 0
-ENV GRID_MAX_SESSION 5
-ENV GRID_UNREGISTER_IF_STILL_DOWN_AFTER 30000
+EXPOSE 4445
+
+ENV GRID_NEW_SESSION_WAIT_TIMEOUT=-1
+ENV GRID_JETTY_MAX_THREADS=-1
+ENV GRID_NODE_POLLING=5000
+ENV GRID_CLEAN_UP_CYCLE=5000
+ENV GRID_TIMEOUT=30000
+ENV GRID_BROWSER_TIMEOUT=0
+ENV GRID_MAX_SESSION=5
+ENV GRID_UNREGISTER_IF_STILL_DOWN_AFTER=30000
 
 COPY generate_config /opt/selenium/generate_config
 COPY entry_point.sh /opt/bin/entry_point.sh
diff --git a/NodeBase/Dockerfile.txt b/NodeBase/Dockerfile.txt
index 47efc8fc..d442e177 100644
--- a/NodeBase/Dockerfile.txt
+++ b/NodeBase/Dockerfile.txt
@@ -1,13 +1,14 @@
 MAINTAINER Selenium <[email protected]>
 
-ENV DEBIAN_FRONTEND noninteractive
-ENV DEBCONF_NONINTERACTIVE_SEEN true
+ENV DEBIAN_FRONTEND=noninteractive
+ENV DEBCONF_NONINTERACTIVE_SEEN=true
 
 #===================
 # Timezone settings
 # Possible alternative: https://github.com/docker/docker/issues/3359#issuecomment-32150214
 #===================
-ENV TZ "US/Pacific"
+ENV TZ="US/Pacific"
+
 RUN echo "${TZ}" > /etc/timezone \
   && dpkg-reconfigure --frontend noninteractive tzdata
 
@@ -31,10 +32,10 @@ RUN chmod +x /opt/bin/entry_point.sh
 #============================
 # Some configuration options
 #============================
-ENV SCREEN_WIDTH 1360
-ENV SCREEN_HEIGHT 1020
-ENV SCREEN_DEPTH 24
-ENV DISPLAY :99.0
+ENV SCREEN_WIDTH=1360
+ENV SCREEN_HEIGHT=1020
+ENV SCREEN_DEPTH=24
+ENV DISPLAY=:99.0
 
 USER seluser
 
diff --git a/NodeChrome/Dockerfile.txt b/NodeChrome/Dockerfile.txt
index ba518e9f..dedf1edb 100644
--- a/NodeChrome/Dockerfile.txt
+++ b/NodeChrome/Dockerfile.txt
@@ -36,9 +36,9 @@ RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.stor
 #========================
 # Selenium Configuration
 #========================
-ENV NODE_MAX_INSTANCES 1
-ENV NODE_MAX_SESSION 1
-ENV NODE_REGISTER_CYCLE 5000
+ENV NODE_MAX_INSTANCES=1
+ENV NODE_MAX_SESSION=1
+ENV NODE_REGISTER_CYCLE=5000
 COPY generate_config /opt/selenium/generate_config
 RUN chmod +x /opt/selenium/generate_config
 
diff --git a/NodeChromeDebug/Dockerfile b/NodeChromeDebug/Dockerfile
index 3280c229..b614950b 100644
--- a/NodeChromeDebug/Dockerfile
+++ b/NodeChromeDebug/Dockerfile
@@ -20,8 +20,8 @@ RUN apt-get update -qqy \
 #=================
 # Locale settings
 #=================
-ENV LANGUAGE en_US.UTF-8
-ENV LANG en_US.UTF-8
+ENV LANGUAGE=en_US.UTF-8
+ENV LANG=en_US.UTF-8
 RUN locale-gen en_US.UTF-8 \
   && dpkg-reconfigure --frontend noninteractive locales \
   && apt-get update -qqy \
diff --git a/NodeDebug/Dockerfile.txt b/NodeDebug/Dockerfile.txt
index 045d2f8a..3a435ae7 100644
--- a/NodeDebug/Dockerfile.txt
+++ b/NodeDebug/Dockerfile.txt
@@ -15,8 +15,14 @@ RUN apt-get update -qqy \
 #=================
 # Locale settings
 #=================
-ENV LANGUAGE en_US.UTF-8
-ENV LANG en_US.UTF-8
+ENV LANGUAGE=en_US.UTF-8
+ENV LANG=en_US.UTF-8
+
+RUN apt-get update -qqy \
+  && apt-get -qqy --no-install-recommends install \
+    locales \
+  && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
+
 RUN locale-gen en_US.UTF-8 \
   && dpkg-reconfigure --frontend noninteractive locales \
   && apt-get update -qqy \
diff --git a/NodeFirefox/Dockerfile.txt b/NodeFirefox/Dockerfile.txt
index 95ed318c..c279059f 100644
--- a/NodeFirefox/Dockerfile.txt
+++ b/NodeFirefox/Dockerfile.txt
@@ -5,7 +5,10 @@ USER root
 #=========
 # Firefox
 #=========
-ARG FIREFOX_VERSION=47.0.1
+#ARG FIREFOX_VERSION=47.0.2
+#ARG FIREFOX_VERSION=50.0.2
+#ARG FIREFOX_VERSION=88.0.1
+ARG FIREFOX_VERSION=130.0
 RUN apt-get update -qqy \
   && apt-get -qqy --no-install-recommends install firefox \
   && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
@@ -20,7 +23,9 @@ RUN apt-get update -qqy \
 #============
 # GeckoDriver
 #============
-ARG GECKODRIVER_VERSION=0.10.0
+#ARG GECKODRIVER_VERSION=0.10.0
+#ARG GECKODRIVER_VERSION=0.29.1
+ARG GECKODRIVER_VERSION=0.35.0
 RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz \
   && rm -rf /opt/geckodriver \
   && tar -C /opt -zxf /tmp/geckodriver.tar.gz \
@@ -33,9 +38,9 @@ RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geck
 #========================
 # Selenium Configuration
 #========================
-ENV NODE_MAX_INSTANCES 1
-ENV NODE_MAX_SESSION 1
-ENV NODE_REGISTER_CYCLE 5000
+ENV NODE_MAX_INSTANCES=1
+ENV NODE_MAX_SESSION=1
+ENV NODE_REGISTER_CYCLE=5000
 COPY generate_config /opt/selenium/generate_config
 RUN chmod +x /opt/selenium/generate_config \
   && chown -R seluser:seluser /opt/selenium
diff --git a/NodeFirefoxDebug/Dockerfile.txt b/NodeFirefoxDebug/Dockerfile.txt
index 815156f3..4b5d72e6 100644
--- a/NodeFirefoxDebug/Dockerfile.txt
+++ b/NodeFirefoxDebug/Dockerfile.txt
@@ -16,8 +16,9 @@ RUN apt-get update -qqy \
 #=================
 # Locale settings
 #=================
-ENV LANGUAGE en_US.UTF-8
-ENV LANG en_US.UTF-8
+ENV LANGUAGE=en_US.UTF-8
+ENV LANG=en_US.UTF-8
+
 RUN locale-gen en_US.UTF-8 \
   && dpkg-reconfigure --frontend noninteractive locales \
   && apt-get update -qqy \
diff --git a/Standalone/Dockerfile.txt b/Standalone/Dockerfile.txt
index efbbdbf6..23dfab20 100644
--- a/Standalone/Dockerfile.txt
+++ b/Standalone/Dockerfile.txt
@@ -11,3 +11,5 @@ RUN chmod +x /opt/bin/entry_point.sh
 USER seluser
 
 EXPOSE 4444
+
+EXPOSE 4445
diff --git a/StandaloneChromeDebug/Dockerfile b/StandaloneChromeDebug/Dockerfile
index e5780cd1..ea0fdc23 100644
--- a/StandaloneChromeDebug/Dockerfile
+++ b/StandaloneChromeDebug/Dockerfile
@@ -20,8 +20,8 @@ RUN apt-get update -qqy \
 #=================
 # Locale settings
 #=================
-ENV LANGUAGE en_US.UTF-8
-ENV LANG en_US.UTF-8
+ENV LANGUAGE=en_US.UTF-8
+ENV LANG=en_US.UTF-8
 RUN locale-gen en_US.UTF-8 \
   && dpkg-reconfigure --frontend noninteractive locales \
   && apt-get update -qqy \
diff --git a/Test/Dockerfile b/Test/Dockerfile
index bbb98751..3a24e5c6 100644
--- a/Test/Dockerfile
+++ b/Test/Dockerfile
@@ -1,5 +1,5 @@
 FROM node:4.5.0-onbuild
 MAINTAINER Selenium <[email protected]>
 
-ENV TEST_CMD ""
+ENV TEST_CMD=""
 # The remainder of this build will be completed by the upstream image's ONBUILD commands

Here are the latest instructions:

git clone [email protected]:SeleniumHQ/docker-selenium.git
cd docker-selenium
git checkout refs/tags/2.53.1-beryllium
make generate_all

# replaced "ENV var_name var_value" into "ENV var_name=var_value" in these files:
#- NodeBase/Dockerfile.txt
#- NodeFirefox/Dockerfile.txt

# in the "Base/Dockerfile" added "libasound2 \" (on a new line) after "wget \"
# in the "Base/Dockerfile" added "tzdata \" (on a new line) after "libasound2 \"
# in the "Base/Dockerfile" added "pciutils \" (on a new line) after "tzdata \"
# in the "Base/Dockerfile" added "libglu1-mesa-dev \" (on a new line) after "pciutils \"

# in the "NodeFirefox/Dockerfile.txt" change
- firefox version to 130.0
- geckodriver version to 0.35.0

# add this to "NodeDebug/Dockerfile.txt" above "RUN locale-gen ..." line 

RUN apt-get update -qqy \
  && apt-get -qqy --no-install-recommends install \
    locales \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Run either this get regular image:
VERSION="2.53.1-custom" BUILD_ARGS="--platform linux/amd64" make standalone_firefox

# Run either this get regular image & debug image with VNC capabilities (the password to VNC is `secret`):
VERSION="2.53.1-custom" BUILD_ARGS="--platform linux/amd64" make standalone_firefox_debug

@aik099
Copy link
Member Author

aik099 commented Nov 7, 2024

Yesterday I tried a simple dockerfile (based on your short example above) and was trying to analyse the last layer (apt-get update), but the usual tools I use both failed (dive is quite broken (and apparently abandoned) and PhpStorm/IDEA is also currently broken 🤦).^

I've used Docker Desktop and "SSHed" into the container using Bash to see what's happening inside any trying to do different stuff.

@uuf6429
Copy link
Member

uuf6429 commented Nov 7, 2024

The idea behind dive/analysis was to see exactly what changed in the apt-get update layer.

Mostly because I was confused from what you said, that running apt-get update would update firefox, since AFAIK only apt-get upgrade actually updates apps/libs (the other one just updates catalogs/indexes).

Anyway, I'll give this a look later on today.

@aik099
Copy link
Member Author

aik099 commented Nov 7, 2024

The idea behind dive/analysis was to see exactly what changed in the apt-get update layer.

Upgrading existing packages doesn't break anything OS-wide (the new Firefox version after the upgrade works by itself).

It's something that Selenium Server 2 does to communicate with Firefox, which causes a problem on Ubuntu specifically. We can almost be certain about this because Selenium Server 3 is working just fine with the same Firefox version on the same container, whereas Selenium Server 2 doesn't.

I know for sure, that Selenium Server 2 on macOS does work with Firefox 130.0.2. This proves once again, that it's a Ubuntu-specific issue, that needs to be uncovered.

Mostly because I was confused from what you said, that running apt-get update would update firefox, since AFAIK only apt-get upgrade actually updates apps/libs (the other one just updates catalogs/indexes).

Maybe it was a typo (usage of apt-get update instead of apt-get upgrade) considering comment writing time (late evening) and my unfamiliarity with the Ubuntu package manager. My apologies for the confusion it caused.

@uuf6429
Copy link
Member

uuf6429 commented Nov 7, 2024

My apologies for the confusion it caused.

No problem at all.

On that point, that's also an aspect of Docker that I like - I tend to avoid manual changes/adjustments and keep iterating on the Dockerfile since in theory it should guarantee consistency (and I know that I can simply share that file with other people).

@uuf6429
Copy link
Member

uuf6429 commented Nov 9, 2024

I've set up a mostly working (builds & stuff connects) Dockerfile, however something seems to break (seems consistent with the earlier comment). Here are the test results:

Firefox Geckodriver Selenium Results
47.0.1 0.14.0 2.53.1 D&D Test Fails
47.0.1 0.35.0 2.53.1 D&D Test Fails
47.0.1 0.14.0 3.14.0 Immediate failure without any logging
47.0.1 0.35.0 3.14.0 Fails after a long time, with weird log1
48.0.1 0.14.0 2.53.1 Connection Error 2
48.0.1 0.15.0 2.53.1 Connection Error 2
48.0.1 0.16.0 2.53.1 Connection Error 2
48.0.1 0.18.0 2.53.1 Connection Error 2
95.0.1 0.14.0 2.53.1 Connection Error 2
95.0.1 0.35.0 2.53.1 Connection Error 2
130.0 0.35.0 3.141.59 Tests pass
130.0 0.14.0 3.141.59 Cannot create session, but no logs3

This seems consistent with claims like: https://groups.google.com/g/selenium-developers/c/d8KpXpmDp2g?pli=1 as well as the releases notes for geckodriver v0.15.0 and v0.16.0. That said, there were reports in the past that the port 7055 problem could be related to unsigned extensions or so - I haven't played with that yet.

Here's my Dockerfile:

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && \
    apt-get install -y \
            wget \
            curl \
            unzip \
            openjdk-8-jdk \
            ca-certificates \
            libx11-6 \
            libx11-dev \
            libxext6 \
            libxrender1 \
            libgtk-3-0 \
            libdbus-1-3 \
            libasound2 \
            libnss3 \
            libgdk-pixbuf2.0-0 \
            libdbus-glib-1-2 \
            x11vnc \
            xvfb \
            xterm \
            git \
            python3 \
            python3-pip \
            libpci-dev \
            libegl1-mesa \
    && rm -rf /var/lib/apt/lists/*

# Install noVNC
RUN git clone https://github.com/novnc/noVNC.git /opt/noVNC && \
    ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html

# Install Firefox
ENV FIREFOX_VERSION=95.0.1
RUN wget -q "https://ftp.mozilla.org/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2" -O /tmp/firefox.tar.bz2 && \
    tar -xjf /tmp/firefox.tar.bz2 -C /opt && \
    mv /opt/firefox /opt/firefox-${FIREFOX_VERSION} && \
    ln -s /opt/firefox-${FIREFOX_VERSION}/firefox /usr/local/bin/firefox

# Install GeckoDriver
ENV GECKODRIVER_VERSION=v0.35.0
RUN wget -q "https://github.com/mozilla/geckodriver/releases/download/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz" -O /tmp/geckodriver.tar.gz && \
    tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin && \
    chmod +x /usr/local/bin/geckodriver

# Install Selenium
ENV SELENIUM_VERSION=2.53.1
RUN wget -q "https://github.com/SeleniumHQ/selenium/releases/download/selenium-${SELENIUM_VERSION}/selenium-server-standalone-${SELENIUM_VERSION}.jar" -O /opt/selenium-server.jar

ENV SELENIUM_PORT=4444
ENV VNC_PORT=5900
ENV NOVNC_PORT=7900

# Expose ports for VNC and noVNC
EXPOSE ${SELENIUM_PORT} ${VNC_PORT} ${NOVNC_PORT}

ENV DISPLAY=:1
#ENV MOZ_HEADLESS=1
#ENV MOZ_WEBRENDER=0
#ENV MOZ_DISABLE_GPU=1
#ENV MOZ_ENABLE_WAYLAND=1

# Start VNC server and Selenium server, and run noVNC
CMD [ "sh", "-c", "\
      /usr/bin/Xvfb ${DISPLAY} -screen 0 1280x1024x24 & \
      x11vnc -display ${DISPLAY} -forever -shared -nopw -ncache 10 -rfbport ${VNC_PORT} & \
      /opt/noVNC/utils/novnc_proxy --vnc localhost:${VNC_PORT} --listen ${NOVNC_PORT} & \
      java -jar /opt/selenium-server.jar -port ${SELENIUM_PORT} --debug"]

PS: Installing libegl1-mesa fixes the glxtest: libEGL missing error.

Footnotes

  1. HTTP Status: '500' -> incorrect JSON status mapping for 'timeout'

  2. Exception: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. 2 3 4 5 6

  3. DriverException : Could not start driver: Unable to create new remote session.

@uuf6429
Copy link
Member

uuf6429 commented Nov 10, 2024

Hmm, I've found some additional details:

  1. Selenium 2 supports Firefox up to version 47, through the builtin FirefoxDriver.
  2. Firefox 48 and newer requires geckodriver and Selenium 3 to work correctly.

It's unclear to me in which case geckodriver <0.15.0 would have made sense.


I think at this point I'd consider simply disabling (or ignoring-failures of) the firefox-on-selenium2 build (or at least, the failing D&D test). The chrome build is good enough and it should be clear to end users that selenium 2 is greatly outdated and therefore there will be some lack of support.

@aik099
Copy link
Member Author

aik099 commented Nov 10, 2024

Maybe all these restrictions apply on Ubuntu (Linux)? I've justed executed test testDragDropOntoHiddenItself test using BrowserStack on Selenium Server 2.45.0 + Firefox 130.0 + Windows 10.

I'm wondering why this works on both Mac and Windows, but not on Linux.

@uuf6429
Copy link
Member

uuf6429 commented Nov 10, 2024

I don't fully understand your setup. So you mean that behat/mink + selenium is on your local machine and Firefox is on Windows in browserstack?

Would it be possible to find me the exact capabilities being sent?

@aik099
Copy link
Member Author

aik099 commented Nov 10, 2024

  • The Web Server is on my Machine.
  • I start test suite on my machine.
  • Selenium Server and Firefox and OS, where Firefox runs are on the BrowserStack side.
  • I'm using BrowserStackLocal app to create tunnel between my computer and BrowserStack so that it can open URLs, that are accessible only from my local network.
  • In the \Behat\Mink\Tests\Driver\Selenium2Config::createDriver method I've added this code (the 2nd argument are desired capabilities):
return new Selenium2Driver(
            'firefox',
            array(
                'build' => 'MinkSelenium2Driver Tests - Selenium2 Setting Detection',
                'browserstack.local' => 'true',
                'browserstack.localIdentifier' => 'nativeapp:...',
                'acceptInsecureCerts' => true,
                'version' => 131,
            ),
            'http://username:[email protected]/wd/hub'
        );
  • then in \Behat\Mink\Driver\Selenium2Driver::start method after connection is made I'm doing $this->webDriver->status() to get Selenium version being used.

The desired capabilities, that BrowserStack receives are as follows:

browserName: firefox
name: Behat Test
build: MinkSelenium2Driver Tests - Selenium2 Setting Detection
version: 131
acceptSslCert: true
browserstack.seleniumLogs: true
localVersion: 8.9
browser: firefox
browser_version: 131
browserstack.tunnel: true
browserstack.tunnelIdentifier: nativeapp:...
browserstack.local: true
browserstack.localIdentifier: nativeapp:...

@uuf6429
Copy link
Member

uuf6429 commented Nov 10, 2024

I tried a few combinations and ideas without success.
My guess in that set up is that Browserstack is doing something to restore compatibility - either by somehow hacking up selenium or geckodrive or perhaps installing some extension in firefox to replace the old FirefoxDriver. Maybe check the exact versions of those and then check if firefox has any special extensions set up?

Finally, I tried a Docker-less setup on my Windows machine with Selenium 2, Firefox 132 and Geckodriver 0.35.0 and I pretty much got the same error (Firefox did indeed start):

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

	at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
	at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:129)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:91)
	at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:68)
	at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
	at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
	at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
18:09:38.706 WARN - Process refused to die after 10 seconds, and couldn't taskkill it

@aik099
Copy link
Member Author

aik099 commented Nov 11, 2024

Double-checking on Windows 11 (in VM) locally + Selenium 2 + newer Firefox + Geckodriver 0.35.0 resulted in the same 45000 ms timeout.

So obviously BrowserStack is doing something to make Selenium 2 work with newer Firefox versions, that regular developers can't do. This means we shouldn't even support Selenium 2 with newer Firefox browser versions, because it can't work.

@uuf6429 , Let's instead focus on attempting to exclude that testDragDropOntoHiddenItself test for Selenium 2 + Firefox to make the test suite green again.

We can likely skip that test based on the SELENIUM_VERSION and WEB_FIXTURES_BROWSER environment variables in the \Behat\Mink\Tests\Driver\Selenium2Config::skipMessage method.

uuf6429 added a commit to minkphp/webdriver-classic-driver that referenced this issue Nov 12, 2024
uuf6429 added a commit to minkphp/webdriver-classic-driver that referenced this issue Nov 12, 2024
* Support MinkSelenium2Driver page timeout

* Trigger deprecation of old-style page timeout

* Replace duplicate code with comment

* Test deprecations

* Rework custom tests to not depend on magic setup

* Set up standard defaults to avoid contaminated sessions

* [debug] Only run tests that fail

* [debug] Adjusted PHPUnit 10 test filtering expression to work on PHPUnit 9

* [debug] remove irrelevant (for debugging) build config sections to speed it up

* [debug] Reduce matrix size even more

* Don't let driver define Selenium Server default timeouts

* [debug] confirm, that timeout tests executed at the beginning would break window tests down the road

* Revert "[debug] confirm, that timeout tests executed at the beginning would break window tests down the road"

This reverts commit b33289b.

* [debug] see if Selenium actually sets timeouts as needed

* Don't reset timeout at the test end, because new driver instance is created in setup

* [debug] PhpStan fix

* [debug] see if session with incorrect timeout is shared between tests

* Fixed formatting error

* [debug] see if deprecation catching causes timeout issues

* [debug] see of sleepy page causes a timeout issue

* [debug] change data provider declaration of the timeouts test

* [debug] removed debug output in the driver code, because not timeouts are causing the issue with window test

* [debug] Look inside GitHub Actions with an SSH session

* [debug] start web server outside of PHPUnit bootstrap file

* [debug] remove unrelated build config parts

* [debug] corrected host of locally started mink server

* [debug] corrected hostname for started web server checking

* [debug] another try to get local web server running

* [debug] reduce test count to figure out why web server is not working

* [debug] Experiment with WEB_FIXTURES_HOST env var detection

* [debug] another try to debug what URL is actually used by test suite

* [debug] another try

* Allow overriding env vars from "phpunit.xml.dist" via env vars from GitHub Actions

* [debug] removed some of the debug code

* [debug] change local web server detection code to avoid it's crashing in the checking process

* [debug] try to make web server available for Selenium Server

* [debug] undo experimental port mapping

* [debug] attempt to start web sever on all ips

* [debug] rolled back CI code that reduced build count

* [debug] rolled back the debug code, that started web server outside of PHPUnit code

* rolled back changes to "phpunit.xml.dist" (to be discussed in other issue)

* Partially skip short "pageLoad" timeout test in Google Chrome

* Fully skip short "pageLoad" timeout test in Google Chrome

* Only skip test added in this PR for Google Chrome

* Apparently "chromium" and "edge" browsers also freeze, when setting "pageLoad" timeout several times. So skip test in there as well.

* Exclude timeout deprecation test only on GitHub Actions

* Minor test fixes and improvements

* Disable test on old firefox

* Fix minkphp/MinkSelenium2Driver#391

---------

Co-authored-by: Alex <[email protected]>
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.

3 participants