-
-
Couldn't load subscription status.
- Fork 2.6k
-
I am trying to retrieve the browser console logs from Firefox. I'm able to do this with the Chrome container but have been unsuccessful using the Firefox container.
Firefox offers a couple preferences to redirect console logs to stdout devtools.console.stdout.content and devtools.console.stdout.chrome. However, I don't believe the Firefox container is capturing the stdout from Firefox.
Is there a way to capture stdout coming from the Firefox browser? Maybe there's a way to redirect the output to a file? The only output coming from the docker run ... cmd seems to be the Selenium log.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
You can capture Firefox browser console logs by enabling the preferences below in your moz: firefoxOptions capabilities:
Json -
"moz:firefoxOptions": {
"prefs": {
"devtools.console.stdout.content": true,
"devtools.console.stdout.chrome": true
}
}
Then start Firefox with --jsconsole or --console flags.
If running inside Docker, you can map a log file path like:
Gitbash -
docker run ... > firefox_console.log 2>&1
Finally, use docker logs <container_id> to retrieve the console output. This approach works reliably for most recent Selenium-Firefox images.
Beta Was this translation helpful? Give feedback.
All reactions
-
Well, this works if you're just running Firefox by itself from the terminal. The output gets printed to stdout. However, this is not the issue I'm facing.
When Selenium launches Firefox, the output doesn't go to docker logs. The logs from docker logs only show output from the starting process which is java -jar selenium-server.jar... (https://github.com/SeleniumHQ/docker-selenium/blob/trunk/Standalone/start-selenium-standalone.sh#L217).
So how can I capture the stdout from a process in the Selenium-Firefox image that is not the starting/entrypoint process?
Beta Was this translation helpful? Give feedback.