"get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp using Selenium GeckoDriver on remote Ubuntu ligthsail - selenium

I'm struggling with the Firefox webdriver implementation on a Lightsail instance since few days.
I'm trying to make run this simple code:
opts = FirefoxOptions()
opts.add_argument('-headless')
driver = webdriver.Firefox(options=opts)
print(f"Driver creation: {time.perf_counter() - ts}")
ts = time.perf_counter()
driver.install_addon(os.path.abspath('metamask-10.2.2-an+fx.xpi'), temporary=True)
print(f"Add on installation: {time.perf_counter() - ts}")
ts = time.perf_counter()
driver.get('https://www.youtube.com')
print(f"Go to Youtube: {time.perf_counter() - ts}")
driver.close()
On my local machine, I got for result:
Driver creation: 1.2246361820007223
Add on installation: 0.9261693749995175
Go to Youtube: 1.8188569550002285
And the geckodriver.log:
1644664439885 geckodriver INFO Listening on 127.0.0.1:48035
1644664439888 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-headless" "--remote-debugging-port" "55337" "-no-remote" "-profile" "/tmp/rust_mozprofileyCDIKp"
*** You are running in headless mode.
1644664440148 Marionette INFO Marionette enabled
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofileyCDIKp/search.json.mozlz4", (void 0)))
DevTools listening on ws://localhost:55337/devtools/browser/1817941e-57a7-42f0-92dc-cc6c9aabaf0b
1644664441030 Marionette INFO Listening on port 43901
1644664441101 RemoteAgent WARN TLS certificate errors will be ignored for this session
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/background-6.js, line 46: asm.js type error: expecting argument type declaration for 'e' of the form 'arg = arg|0' or 'arg = +arg' or 'arg = fround(arg)'
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/ui-3.js, line 7: unreachable code after return statement
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/ui-3.js, line 7: unreachable code after return statement
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/ui-3.js, line 7: unreachable code after return statement
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/ui-5.js, line 1: unreachable code after return statement
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/ui-5.js, line 1: unreachable code after return statement
JavaScript warning: moz-extension://4ba69c0a-421f-4439-bc86-32f0a1c5a733/ui-5.js, line 1: unreachable code after return statement
1644664442980 Marionette WARN Ignoring event 'pageshow' because document has an invalid readyState of 'uninitialized'.
I would like to have approximatly the same result on my remote Lightsail instance.
I tried a lot of solution I found on google, but nothing worked, so this is what I did:
Delete instance -> Create a new one (Ubuntu 20.04LTS)
Make server routine:
sudo apt-get update
sudo apt-get upgrade
Install GeckoDriver:
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar -xvzf geckodriver*
chmod +x geckodriver
sudo mv geckodriver /usr/local/bin/
Install Firefox:
sudo apt install firefox
Install python3-pip and the requirements for selenium.
The result after launching a test:
Driver creation: 6.041947366000045
Add on installation: 11.09006381100005
==> Server block after few minutes
and the geckodriver.log:
1644660948039 geckodriver INFO Listening on 127.0.0.1:41557
1644660948538 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-headless"
"--disable-dev-shm-usage" "--no-sandbox" "--window-size=1920,1080" "--ignore-certificate-errors" "--allow-runni
ng-insecure-content" "--proxy-server=\'direct://\'" "--proxy-bypass-list=*" "--start-maximized" "--disable-gpu"
"--disable-setuid-sandbox" "--remote-debugging-port" "58861" "-no-remote" "-profile" "/tmp/rust_mozprofilejTQJ
s8"
*** You are running in headless mode.
[GFX1-]: glxtest: libGL.so.1 missing
[GFX1-]: glxtest: libEGL missing
1644660949544 Marionette INFO Marionette enabled
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open t
he file at /tmp/rust_mozprofilejTQJs8/search.json.mozlz4", (void 0)))
DevTools listening on ws://localhost:58861/devtools/browser/73d9a07f-26e3-45aa-b118-79158a25d2dd
1644660953547 Marionette INFO Listening on port 46187
1644660953617 RemoteAgent WARN TLS certificate errors will be ignored for this session
The difference I found from the local geckodriver.log, is about libGL and libEgl, so I install:
apt install libgl1-mesa-glx
apt install libegl-dev
After testing:
Driver creation: 5.604287772000134
Add on installation: 52.37673208100023
==> Block after few minutes
The geckodriver.log:
1644671693878 geckodriver INFO Listening on 127.0.0.1:38405
1644671694374 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-headless"
"--remote-debugging-port" "35887" "-no-remote" "-profile" "/tmp/rust_mozprofileNhzPGd"
*** You are running in headless mode.
[GFX1-]: glxtest: Unable to open a connection to the X server
[GFX1-]: glxtest: libEGL missing
1644671695500 Marionette INFO Marionette enabled
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open t
he file at /tmp/rust_mozprofileNhzPGd/search.json.mozlz4", (void 0)))
DevTools listening on ws://localhost:35887/devtools/browser/b99cd6dd-92a1-4c98-aec0-8c2dfb6c29b1
1644671699397 Marionette INFO Listening on port 39313
1644671699537 RemoteAgent WARN TLS certificate errors will be ignored for this session
JavaScript warning: moz-extension://2c7aa371-d63f-4896-8c5f-dab9902639ff/background-6.js, line 46: asm.js type
error: expecting argument type declaration for 'e' of the form 'arg = arg|0' or 'arg = +arg' or 'arg = fround(a
rg)'
I really don't know how to make it work on my Lightsail instance.
I don't know what I can add to help someone to find a solution, maybe the versionning on my remote:
firefox -v: Mozilla Firefox 96.0
I tried a lot of other solutions found on the web, but as I don't understand what's the problem, everything else does nothing more.
Thanks advance.

This error message...
1644671694374 mozrunner::runner INFO Running command: "/usr/bin/firefox" "--marionette" "-headless" "--remote-debugging-port" "35887" "-no-remote" "-profile" "/tmp/rust_mozprofileNhzPGd"
*** You are running in headless mode.
[GFX1-]: glxtest: Unable to open a connection to the X server
[GFX1-]: glxtest: libEGL missing
1644671695500 Marionette INFO Marionette enabled
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at /tmp/rust_mozprofileNhzPGd/search.json.mozlz4", (void 0)))
...implies that the GeckoDriver instance was unable to initiate/spawn a new Browsing Context.
The most probable reason is there is/are dangling/zombie rust_mozprofile instances clinging within the /tmp directory. As a result, though /tmp/rust_mozprofileNhzPGd was created by GeckoDriver but /tmp/rust_mozprofileNhzPGd/search.json.mozlz4 can't be accessed.
Solution
You need to invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully at the end of each execution. Incase the dangling/zombie GeckoDriver process still continues to occupy your system memory you need to forcefully kill them.
References
You can find a relevant detailed discussions in:
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new Error("", "(unknown module)")) using Selenium and Java
Error: Can't find profile directory. console.warn: SearchSettings: "get: No settings file exists, new profile?" using GeckoDriver Firefox and Selenium
Additionally, you may need to update the firefox version to the latest release of v97.0.

Related

Sidekiq job getting Selenium::WebDriver::Error::UnknownError: invalid argument: can't kill an exited process (but only when run async) [duplicate]

Server: Raspberry Pi 3
OS: Dietpi - version 159
Geckodriver version: 0.22 for arm
Firefox version: 52.9.0
Python version: 3.5
Selenium version: 3.14.1
Gecko is executable, and is located in /usr/local/bin/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.options import Options
import time
options = Options()
options.set_headless(headless=True)
driver = webdriver.Firefox(firefox_options=options)
print('Need your login credential')
username = input('What is your username?:\n')
password = input('What is your password?:\n')
...
...
Output:
root#RPi3:~# python3.5 ITE-bot.py
Traceback (most recent call last):
File "ITE-bot.py", line 12, in <module>
driver = webdriver.Firefox(firefox_options=options)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
keep_alive=True)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
Any idea what is wrong? I've tried google without luck.
If you are running Firefox on a system with no display, make sure you use headless mode.
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
Also, make sure you have compatible versions of Firefox, Selenium, and Geckodriver:
https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
Thumb rule
A common cause for Browsers to crash during startup is running WebDriver initiated Browsers as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Browser as a regular user instead.
This error message...
selenium.common.exceptions.WebDriverException: Message: invalid argument: can't kill an exited process
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your GeckoDriver version is 0.22.0.
Release Notes of GeckoDriver v0.21.0 (2018-06-15) clearly mentions the following:
Firefox 57 (and greater)
Selenium 3.11 (and greater)
Your Firefox version is 52.9.0.
So there is a clear mismatch between GeckoDriver v0.22.0 and the Firefox Browser v57
Solution
Upgrade GeckoDriver to GeckoDriver v0.22.0 level.
GeckoDriver is present in the specified location.
GeckoDriver is having executable permission for non-root users.
Upgrade Firefox version to Firefox v62.0.2 levels.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Execute your Selenium Test as a non-root user.
GeckoDriver, Selenium and Firefox Browser compatibility chart
I was on headless mode, using correct versions of everything, and the only way to get out of this error message was not to execute the selenium test as root
Yes checked Start Xvfb before the build can fix the problem, but if you have a job like a pipeline or multibranch pipeline this option is not visible. In the node of your Selenium grid that you go to execute the test you need:
1- Install Xvfb: apt install xvfb
2- Execute Xvfb: /usr/bin/Xvfb :99 -ac -screen 0 1024x768x8 & export DISPLAY=":99"
3- Rerun your node, for example: java -jar selenium.jar -role node -hub http://#.#.#.#:4444/grid/register -capabilities browserName=firefox,plataform=linux -host #.#.#.# -port 1991
This solution worked for me
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
As there can be many different underlying causes for this error it is best to find the root cause setting selenium to use debug level logging. In my case, for Ruby with capybara I needed to set: Selenium::WebDriver.logger.level = :debug. And voilĂ , running the same spec I could see in the logs that a dependency was missing, in my case:
libdbus-glib-1.so.2: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
After installing it all worked fine.
I used:
VS Code
Linunx/Ubuntu:18.10
Nightwatch.js
My problem was that I tried to run Nightwatch (which automatically starts GeckoDriver) from the VS Code terminal.
I had the same problem, and realized that the real problem was some firefox dependencies not being installed inside the docker container I was testing in.
Try to initiate firefox and check if it returns an error.
As Nico and jay have stated you need to check the logs to see the details of the error. As you might use different systems, you can specify the path where the log is stored (i.e. "/tmp/geckodriver.log").
from selenium import webdriver
firefox_options = webdriver.firefox.webdriver.Options()
driver = webdriver.Firefox(log_path="/tmp/geckodriver.log",
options=firefox_options)
In my particular case, what the log said was:
Error: no DISPLAY environment variable specified
That was resolved adding in the options the headless mode before starting the driver. With the line:
firefox_options.set_headless()
I was able to fix this by running my tests with Xvfb. I was running them on a remote server.
I was using Jenkins so I checked the box that looked like this:
Credit to https://www.obeythetestinggoat.com/book/chapter_CI.html
in my case, I was running test cases as root
geckodriver.log
1576076416677 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofilenCbl2e"
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/seluser which is owned by seluser.)
1576077143004 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile7wpSQ7"
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: telemetry
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1576077143689 addons.webextension.screenshots#mozilla.org WARN Loading extension 'screenshots#mozilla.org': Reading manifest: Invalid extension permission: about:reader*
1576077145372 Marionette INFO Listening on port 35571
1576077145423 Marionette WARN TLS certificate errors will be ignored for this session
1576077200207 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofilenhoHlr"
Running Firefox as root in a regular user's session is not supported. ($HOME is /home/seluser which is owned by seluser.)
i could get around by
cd /home
chown -R root seluser
i woundnt say its correct but it got my job done

session not created: Chrome version must be between 71 and 75 [duplicate]

After update of chromedriver to version 2.46 my tasts fail to initialize.
I got message like this:
Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to invoke configuration method com.personal.CustomTest.initTests not created: Chrome version must be between 71 and 75
(Driver info: chromedriver=2.46.628402,platform=Windows NT 10.0.16299 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.58 seconds
Build info: version: '2.53.1'
It is clearly saying that my browser version is not valid. But I am using Chrome 72.0.3626.119 so it is between 71 and 75.
Selenium version is 2.53.1.
And I am running test through console command with the help of testNG.
Any idea? Every ideas that I found was about changing selenium version but I cant do it.
For me to resolve this problem :
On Windows
cd C:\Users\[myname]\AppData\Roaming\npm\node_modules\protractor
npm i webdriver-manager#latest
webdriver-manager update
webdriver-manager start &
On Cent-OS (I used Cent-OS 7.4.* and it worked fine.)
cd /usr/lib/node_modules/protractor/
sudo npm i webdriver-manager#latest
sudo webdriver-manager update
sudo webdriver-manager start &
I hope this helps you in any way.
This error message...
Starting ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1) on port 44269
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Failed to invoke configuration method com.personal.CustomTest.initTests not created: Chrome version must be between 71 and 75
...implies that the ChromeDriver v2.46 is not compatible with the Chrome Browser version which is being accessed by your program/webdriver.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.46
Release Notes of chromedriver=2.46 clearly mentions the following :
Supports Chrome v71-73
Though you mentioned you are using Chrome 72.0.3626.119 possibly there are multiple instances of Chrome Browser installed within your system and your program by default is accessing the Chrome Browser whose version is not between v71.x and v75.x
You are using chrome=67.0
Release Notes of ChromeDriver v2.38 clearly mentions the following :
Supports Chrome v65-67
Solution
Keep JDK upgraded to recent levels JDK 8u201.
Uninstall all the instances of Chrome Browser (you can opt to use Revo Uninstaller).
Upgrade ChromeDriver to current ChromeDriver v2.46 level.
Keep Chrome version between Chrome v71-73 levels. (as per ChromeDriver v2.46 release notes)
For me, I had to update my chrome driver in my project to match the version of Chrome on my local machine.
yarn add chromedriver#76.0.0 -D
https://www.npmjs.com/package/chromedriver
In my case I was getting the same error after my chrome was updated to version 76. Which was happening when chimp tries to use chromedriver to execute the selenium test.
DevTools listening on ws://127.0.0.1:49220/devtools/browser/e88586cb-ed67-44fc-a742-43b767e2b8f9
[chimp][helper] setupBrowserAndDDP had error
{ Error: session not created: Chrome version must be between 71 and 75
at Object.wait (C:\ACPMS\ELS_AT\node_modules\fibers\future.js:449:15)
at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\wdio-sync\build\index.js:344:27)
at Object.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\session-manager.js:145:21)
at initBrowser (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:189:43)
at Object.setupBrowserAndDDP (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\chimp-helper.js:264:7)
at Context.<anonymous> (C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\mocha\mocha-helper.js:13:15)
at C:\ACPMS\ELS_AT\node_modules\chimp\dist\lib\utils\fiberize.js:29:22
(Driver info: chromedriver=2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17134 x86_64)
at new RuntimeError (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\ErrorHandler.js:143:12)
at Request._callback (C:\ACPMS\ELS_AT\node_modules\webdriverio\build\lib\utils\RequestHandler.js:318:39)
at Request.self.callback (C:\ACPMS\ELS_AT\node_modules\request\request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (C:\ACPMS\ELS_AT\node_modules\request\request.js:1161:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous>
For me it didn't work when I updated the chrome driver by npm (both globally and locally) and then I followed these steps to resolve the issue, which might give some idea on where to check in this kind a issue:
Because exception was thrown in node_modules\chimp\dist\lib\utils\fiberize.js i navigated to that file and found one level above this file node_modules\chimp\dist\lib\chromedriver.js which has the code to start chromedriver.
I added a console.log to chromedriverPath which can be seen below and re-executed the tests to get the chromedriver path in console logs.
Chromedriver.prototype.start = function(callback) {
var self = this;
var port = self.options.port;
if (this.child) {
callback();
return;
}
var chromedriverPath = chromedriver.path;
//this was added my me the see that chrome drive path
console.log("[chimp] " + chromedriverPath);
if (fs.existsSync(chromedriverPath)) {
this.child = processHelper.start(
{
bin: chromedriverPath,
prefix: "chromedriver",
args: ["--port=" + port, "--url-base=wd/hub"],
waitForMessage: /Starting ChromeDriver/,
errorMessage: /Error/
},
callback
);
} else {
callback("[chimp][chromedriver] Chromedriver executable not found.");
}
};
When i got the path of the chromedriver which is used to execute the tests, i just navigated to that folder and replaced chromedriver executable with the most recent version.
I hope this helps.
Try this: Download the compatible ChromeDriver.exe file for the updated version of Chrome browser and replace it. It works for me.

Selenium with Firefox-ESR in Alpine Docker image

I'm using Selenium for testing from Java code, it's started automatically with maven, when I run mvn verify it uses gecko-driver to start new firefox instance for selenium:
final FirefoxOptions opts = new FirefoxOptions();
if (HEADLESS_MODE) {
opts.addArguments(ARG_HEADLESS);
}
return new FirefoxDriver(opts);
It's working fine on my machine (and on machines of other developers) in both modes "headless" and normal. Now I'm trying to run Selenium tests with CI builds in Alpine Linux Docker container. When I tried to run it as-is, I've got an error:
mozrunner::runner INFO Running command: "/usr/bin/firefox"
"-marionette" "--headless" "-foreground" "-no-remote"
"-profile" "/tmp/rust_mozprofile.pW1sbkcv98QN"
Error: GDK_BACKEND does not match available displays.
Then I installed all suggested tools (dbus and xvfb) from this post and started it before running tests:
apk add xvfb dbus
dbus-uuidgen > /etc/machine-id
export DISPLAY=:99
Xvfb $DISPLAY -ac &
mvn verify
but now Selenium tests are hadning for about 10 seconds and failing with error
1565433736375 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.1ZMsJ0Hy95V0"
1565433738424 Marionette INFO Listening on port 2828
!!! [Child][MessageChannel] Error: (msgtype=0x3E0003,name=PCompositable::Msg_Destroy) Channel error: cannot send/recv
[Child 2191] ###!!! ABORT: Aborting on channel error.: file /home/buildozer/aports/community/firefox-esr/src/firefox-52.8.1esr/ipc/glue/MessageChannel.cpp, line 2152
[Child 2191] ###!!! ABORT: Aborting on channel error.: file /home/buildozer/aports/community/firefox-esr/src/firefox-52.8.1esr/ipc/glue/MessageChannel.cpp, line 2152
!!! [Child][MessageChannel] Error: (msgtype=0x3E0003,name=PCompositable::Msg_Destroy) Channel error: cannot send/recv
It seems I'm doing something wrong here, what is the correct way to run headless Selenium tests in Alpine Linux Docker container? I'd prefer to configure existing Docker image instead of using Selenium images, because the migration will be expensive.
Update:
Selenium version is 3.141.59
Gecko-driver version is v0.24.0-linux64
Firefox-ESR version is: 52.8.1-r0
Update2:
xvfb, dbus and exported DISPLAY are not actually needed to run Firefox in headless mode - just run firefox --headless and it's all.
As per Mozilla --headless flag is not supported in Firefox 52-esr.Headless flag was introduced in version 55 (for Linux) and 56 (Mac/Windows) . Please try on latest Firefox ESR release.

selenium server standalone: unable to create a new session with vagrant in headless mode

I am trying to run the selenium server standalone in a vagrant box, with the following command:
java -jar selenium-server-standalone-3.13.0.jar
When I click the 'create session' button at http://lab.local:4444/wd/hub/static/resource/hub.html from my host web browser. I get a unable to create a new session error message.
I ask to create a firefox browser session for which I get the driver located in /usr/local/bin/geckodriver.
Firefox has been installed on the vagrant box with sudo apt install firefox-esr.
Error log detail:
14:52:04.485 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.13.0', revision: '2f0d292'
14:52:04.486 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-08-09 14:52:04.564:INFO::main: Logging initialized #312ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:52:04.757 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
14:52:15.563 INFO [ActiveSessionFactory.apply] - Capabilities are: {
"browserName": "firefox"
}
14:52:15.568 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)
1533819135611 geckodriver INFO geckodriver 0.21.0
1533819135614 geckodriver INFO Listening on 127.0.0.1:25541
1533819135880 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.yuusnpGo8Gw6"
1533819136508 Marionette INFO Listening on port 2828
When I run the same executable directly from my host, I get no error and the firefox session is created with success.
I try to run a X server, Xvfb as follow but this does not change anything:
Xvfb :1 -screen 0 1600x1200x16 &
export DISPLAY=:1
java -jar selenium-server-standalone-3.13.0.jar
Problem solved after switching to selenium-server-standalone-3.3.1.jar with geckodriver 0.14.0. Sessions are created with success with this configuration.
source.

Jenkins throws error instantiating firefox, works fine with Maven

1515175026602 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-profile" "C:\\Windows\\TEMP\\rust_mozprofile.MX9tmRHWAJFL"
1515175027227 Marionette INFO Enabled via --marionette
###!!! [Parent][MessageChannel] Error: (msgtype=0x240057,name=PContent::Msg_SetPluginList) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x24004C,name=PContent::Msg_GMPsChanged) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x15008F,name=PBrowser::Msg_UpdateNativeWindowHandle) Channel error: cannot send/recv
###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down
The issue got fixed by installing Jenkins using jenkins.war in the command prompt. Earlier I have installed using .exe file as like usual windows softwares.
.exe instals it as a windows service and .war as a java executable
Run "java -jar jenkins.war" on cmd, configure and run the build, would resolve the problem
this issue may be with unsupported security preferences set up in code, I faced this issue in mac while I was setting up this preference in FF v62. and gecko 0.24
profile.setPreference("security.sandbox.content.level", 5);