You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone! It's my first bug report so sorry if the format is bad.
I've been looking for a solution to this for the last couple of days but the few things I found were about testing with selenium and haven't been of much help.
I am making a Rails app that uses selenium to do web scrapping. Although locally it works just fine, once I run a docker container I get the following log messages
2025-01-07 22:27:25 Starting ChromeDriver 131.0.6778.204 (52183f9e99a61056f9b78535f53d256f1516f2a0-refs/branch-heads/6778_155@{#7}) on port 9515
2025-01-07 22:27:25 Only local connections are allowed.
2025-01-07 22:27:25 Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
**2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]**
2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:29 2025-01-07 13:27:29 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:29 2025-01-07 13:27:29 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
.....
.....
.....
2025-01-07 22:27:42 2025-01-07 13:27:42 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:25 [7e9d73e0-f218-4617-bd30-a5916bc181ad] Completed 500 Internal Server Error in 71391ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
2025-01-07 22:27:25 [7e9d73e0-f218-4617-bd30-a5916bc181ad]
2025-01-07 22:27:25 [7e9d73e0-f218-4617-bd30-a5916bc181ad] **Selenium::WebDriver::Error::WebDriverError (unable to connect to /home/rails/.cache/selenium/chromedriver/linux64/131.0.6778.204/chromedriver 127.0.0.1:9515):**
Even then, I can run chromedriver from the terminal just fine
$ /home/rails/.cache/selenium/chromedriver/linux64/131.0.6778.204/chromedriver
Starting ChromeDriver 131.0.6778.204 (52183f9e99a61056f9b78535f53d256f1516f2a0-refs/branch-heads/6778_155@{#7}) on port 0
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 41375.
I do get the following socket related error when I try to execute chrome and I think the problem might lie here but I am not sure how to go around it. I do intend to use chromedriver headless.
/home/rails/.cache/selenium/chrome/linux64/131.0.6778.204/chrome
[256:275:0107/140103.774691:ERROR:bus.cc(407)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[256:256:0107/140103.776889:ERROR:ozone_platform_x11.cc(244)] Missing X server or $DISPLAY
[256:256:0107/140103.776924:ERROR:env.cc(257)] The platform failed to initialize. Exiting.
I would appreciate if I could get some help with this problem.
How can we reproduce the issue?
This is just the basic ruby on rails app with a couple modifications. Github repo: https://github.com/kevinher7/selenium-docker
Modifications made:
1. Added the selenium-webdriver gem to gemfile
2. Created a service to scrape aka use selenium (could be donein the same place as the controller)
3. Use the scrape class in a controller
and the only modification to the dockerfile was to add the google chrome dependencies as:
RUN apt-get update -qq && \
apt-get install -y fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 \
libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libvulkan1 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon0 \
libxrandr2 xdg-utils && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
Build the Image and then after running it go to the endpoint that triggers the scrapping get the logs mentioned above.
I also played changing to the normal (not slim) version of the ruby image but the problem persisted
### Relevant log output
```shell
2025-01-07 22:27:25 Starting ChromeDriver 131.0.6778.204 (52183f9e99a61056f9b78535f53d256f1516f2a0-refs/branch-heads/6778_155@{#7}) on port 9515
2025-01-07 22:27:25 Only local connections are allowed.
2025-01-07 22:27:25 Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
**2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]**
2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:26 2025-01-07 13:27:26 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:27 2025-01-07 13:27:27 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:28 2025-01-07 13:27:28 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:29 2025-01-07 13:27:29 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:29 2025-01-07 13:27:29 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
.....
.....
.....
2025-01-07 22:27:42 2025-01-07 13:27:42 DEBUG Selenium [:driver_service] polling for socket on ["127.0.0.1", 9515]
2025-01-07 22:27:25 [7e9d73e0-f218-4617-bd30-a5916bc181ad] Completed 500 Internal Server Error in 71391ms (ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
2025-01-07 22:27:25 [7e9d73e0-f218-4617-bd30-a5916bc181ad]
2025-01-07 22:27:25 [7e9d73e0-f218-4617-bd30-a5916bc181ad] **Selenium::WebDriver::Error::WebDriverError (unable to connect to /home/rails/.cache/selenium/chromedriver/linux64/131.0.6778.204/chromedriver 127.0.0.1:9515):**
Operating System
It says that the Ruby image is based on Debian but I am not sure.
Selenium version
Ruby 3.4.1 and selenium-webdriver 4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome 131.0.6778.204 (stable version atm)
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 131.0.6778.204
Are you using Selenium Grid?
No (I think)
The text was updated successfully, but these errors were encountered:
@kevinher7, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
What happened?
Hello everyone! It's my first bug report so sorry if the format is bad.
I've been looking for a solution to this for the last couple of days but the few things I found were about testing with selenium and haven't been of much help.
I am making a Rails app that uses selenium to do web scrapping. Although locally it works just fine, once I run a docker container I get the following log messages
Even then, I can run
chromedriver
from the terminal just fineI do get the following socket related error when I try to execute chrome and I think the problem might lie here but I am not sure how to go around it. I do intend to use chromedriver headless.
I would appreciate if I could get some help with this problem.
How can we reproduce the issue?
Build the Image and then after running it go to the endpoint that triggers the scrapping get the logs mentioned above.
I also played changing to the normal (not slim) version of the ruby image but the problem persisted
Operating System
It says that the Ruby image is based on Debian but I am not sure.
Selenium version
Ruby 3.4.1 and selenium-webdriver 4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome 131.0.6778.204 (stable version atm)
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 131.0.6778.204
Are you using Selenium Grid?
No (I think)
The text was updated successfully, but these errors were encountered: