-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
[🐛 Bug]: selenium wont start with none message shown. #14219
Comments
@woshichuanqilz, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
What happens when you execute on the terminal Please share the terminal output. |
> /home/lizhe/Applications/chromedriver-linux64/chromedriver
Starting ChromeDriver 126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
---
> /home/lizhe/Applications/chrome-linux64/chrome
Created TensorFlow Lite XNNPACK delegate for CPU.
Attempting to use a delegate that only supports static-sized tensors w
ith a graph that has dynamic-sized tensors (tensor#141 is a dynamic-si
zed tensor).
|
That output looks strange for Chrome, is that the correct binary? |
I use
The chrome I used above is from here: https://googlechromelabs.github.io/chrome-for-testing. Not my daily use chrome Then I change the code to this (comment the import logging
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
def test_logging(log_path):
logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(log_path)
logger.addHandler(handler)
logging.getLogger('selenium.webdriver.remote').setLevel(logging.WARN)
logging.getLogger('selenium.webdriver.common').setLevel(logging.DEBUG)
test_logging('ori.log')
CHROMEDRIVER_PATH = '/home/lizhe/Applications/chromedriver-linux64/chromedriver'
options = webdriver.ChromeOptions()
# options.binary_location = '/home/lizhe/Applications/chrome-linux64/chrome'
service = ChromeService(executable_path=CHROMEDRIVER_PATH)
driver = webdriver.Chrome(service=service, options=options)
url = "https://www.google.com"
driver.get(url)
input("please wait...")
Then I get error msg :
My daily used chrome version
Msg output when run daily used chrome:
|
Why don't you let Selenium Manager manage it? Leave it like:
|
At first I just try the code like you write. Still error. Here is the code I tried at first. import logging
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
def test_logging(log_path):
logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(log_path)
logger.addHandler(handler)
logging.getLogger('selenium.webdriver.remote').setLevel(logging.WARN)
logging.getLogger('selenium.webdriver.common').setLevel(logging.DEBUG)
test_logging('ori.log')
driver = webdriver.Chrome()
url = "https://www.google.com"
driver.get(url)
input("please wait...")
|
I don't see the log contents, just the stacktrace. |
What is the stacktrace how to get it ? When I run chrome from command line output : |
What are the contents of |
import logging
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
def test_logging(log_path):
logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(log_path)
logger.addHandler(handler)
logging.getLogger('selenium.webdriver.remote').setLevel(logging.WARN)
logging.getLogger('selenium.webdriver.common').setLevel(logging.DEBUG)
test_logging('ori.log')
driver = webdriver.Chrome()
url = "https://www.google.com"
driver.get(url)
input("please wait...") ori.log
the log seems shows that the chrome not foundI change the code import logging
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
def test_logging(log_path):
logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(log_path)
logger.addHandler(handler)
logging.getLogger('selenium.webdriver.remote').setLevel(logging.WARN)
logging.getLogger('selenium.webdriver.common').setLevel(logging.DEBUG)
test_logging('ori.log')
options = webdriver.ChromeOptions()
options.binary_location = '/usr/bin/google-chrome-stable'
driver = webdriver.Chrome(options)
url = "https://www.google.com"
driver.get(url)
input("please wait...") ori.log
|
Somehow the ChromeDriver you have in path is exiting with code -3. Can you delete that binary and let Selenium Manager download it? |
Can you give me a link about how to use selenium to download the driver? |
I change the code to this. import logging
from webdriver_manager.chrome import ChromeDriver
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
def test_logging(log_path):
logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(log_path)
logger.addHandler(handler)
logging.getLogger('selenium.webdriver.remote').setLevel(logging.WARN)
logging.getLogger('selenium.webdriver.common').setLevel(logging.DEBUG)
test_logging('ori.log')
options = webdriver.ChromeOptions()
options.binary_location = '/usr/bin/google-chrome-stable'
driver = webdriver.Chrome(options=options, service=ChromeService(ChromeDriverManager().install()))
url = "https://www.google.com"
driver.get(url)
input("please wait...") output of command line said cant find chrome but I set it in the option, it is google-chrome-stable ╰─❯ python tes3.py
/bin/sh: line 1: google-chrome: command not found
/bin/sh: line 1: google-chrome: command not found
Traceback (most recent call last):
File "/home/lizhe/tes3.py", line 24, in <module
driver = webdriver.Chrome(options=options, se
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lizhe/pyvenvL/.venv/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
super().__init__(
File "/home/lizhe/pyvenvL/.venv/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
super().__init__(command_executor=executor, options=options)
File "/home/lizhe/pyvenvL/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__
self.start_session(capabilities)
File "/home/lizhe/pyvenvL/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lizhe/pyvenvL/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
self.error_handler.check_response(response)
File "/home/lizhe/pyvenvL/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 193, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: ori.log
|
I create a symbolic link to google-chrome-stable named google-chrome. Rerun the code output
ori.log
|
You are going in circles, this is the same code you used to create the issue. What I requested is for you to delete the ChromeDriver that you have on path and let Selenium Manager handle it. |
I already delete the chromedriver. As you can see in the ori.log. The chromedriver is in the .wdm folder. And the .wdm I also delete and re-download again. |
@woshichuanqilz - I think you are mixing selenium and the webdrivermanager packages. Can you please try the below sample and post back what you see ? import logging
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
def test_logging(log_path):
logger = logging.getLogger('selenium')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(log_path)
logger.addHandler(handler)
logging.getLogger('selenium.webdriver.remote').setLevel(logging.WARN)
logging.getLogger('selenium.webdriver.common').setLevel(logging.DEBUG)
test_logging('ori.log')
options = webdriver.ChromeOptions()
options.binary_location = '/usr/bin/google-chrome-stable'
driver = webdriver.Chrome(options=options, service=ChromeService())
url = "https://www.google.com"
driver.get(url)
print("Page title: ", driver.title)
driver.quit() |
output
ori.log
|
@woshichuanqilz - For the last experiment, can you please comment out
and re-run the sample? Basically we are trying to figure out as to what happens when selenium internally uses selenium manager to download the browser as well and then work with it. In my case, when I had ran that sample on my mac, I got the below message in the logs (which re-iterates what I already knew i.e., the browser was not present in that path) Running command: /usr/bin/google-chrome-stable --version
Output: ""
chrome not found in the system
Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json
Required browser: chrome 126.0.6478.126
Downloading chrome 126.0.6478.126 from https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.126/mac-x64/chrome-mac-x64.zip
chrome 126.0.6478.126 is available at /Users/kmahadevan/.cache/selenium/chrome/mac-x64/126.0.6478.126/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
|
output
ori.log
|
Ok. My guess is that there is some issue when it comes to executing the Have you tried manually running to see if it works fine ? Here's what I see. ➜ 126.0.6478.126 pwd
/Users/kmahadevan/.cache/selenium/chromedriver/mac-x64/126.0.6478.126
➜ 126.0.6478.126 ls -ltr
total 36944
-rwxr-xr-x@ 1 kmahadevan staff 18911688 Jun 28 21:45 chromedriver
➜ 126.0.6478.126 ./chromedriver -v
ChromeDriver 126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591})
➜ 126.0.6478.126 |
You just need this? |
@woshichuanqilz - yeah that output rules out any issues with chromedriver. I noticed in this comment #14219 (comment) that you mentioned you are using CFT version of google chrome. I don't know if that can be related to the problem or not. So to rule out the role of the CFT version of Google chrome, can we try this as well?
#!/bin/sh
curl --location 'localhost:9515/session' \
--header 'Content-Type: application/json; charset=utf-8' \
--data '{
"capabilities": {
"firstMatch": [
{
"browserName": "chrome"
}
]
}
}' JSON response on the terminal {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"126.0.6478.127","chrome":{"chromedriverVersion":"126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591})","userDataDir":"/var/folders/1f/rc_t2_qj41x3_9n8bhn5grr00000gn/T/.org.chromium.Chromium.8Zi5VJ"},"fedcm:accounts":true,"goog:chromeOptions":{"debuggerAddress":"localhost:63445"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"mac","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:extension:minPinLength":true,"webauthn:extension:prf":true,"webauthn:virtualAuthenticators":true},"sessionId":"87213362fb6d1bac0c7a26c33502a3e1"} |
Also.. I think the |
I already delete CFT chrome since this post above. Just use the normal chrome. Same issue.
You mean start the chromedriver first, then run the curl command? Nothing shows in the terminal. I use browser to access "http://localhost:9515/"
.wdm
.cache Contains chrome and chromedriver
|
Yes. That's what I meant. What happens on the terminal when you do that? Does it exit immediately or do you see the prompt stall? Do you see a browser open up?
I dont think that the name of the browser binary matters. You should use |
Nothing happens. |
@woshichuanqilz - What if you start For me I see something like below ➜ 126.0.6478.126 ./chromedriver --log-level=DEBUG
Starting ChromeDriver 126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
[1720008443.822][INFO]: [0391bbb4813c119ff3973f4c446924ff] COMMAND InitSession {
"capabilities": {
"firstMatch": [ {
"browserName": "chrome"
} ]
}
}
[1720008443.822][INFO]: Browser search. Trying... /Users/kmahadevan/.cache/selenium/chromedriver/mac-x64/126.0.6478.126/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
[1720008443.822][INFO]: Browser search. Trying... /Users/kmahadevan/.cache/selenium/chromedriver/mac-x64/126.0.6478.126/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
[1720008443.822][INFO]: Browser search. Trying... /Users/kmahadevan/.cache/selenium/chromedriver/mac-x64/126.0.6478.126/Google Chrome.app/Contents/MacOS/Google Chrome
[1720008443.822][INFO]: Browser search. Trying... /Users/kmahadevan/.cache/selenium/chromedriver/mac-x64/126.0.6478.126/Chromium.app/Contents/MacOS/Chromium Its a verbose log and so I have trimmed the rest of the output. |
Same with no debug flag |
@woshichuanqilz - If you are not able to run @diemol WDYT ? |
I don't think you followed the steps we are asking... Step one, in an empty terminal, where the ChromeDriver binary is placed do:
Step do, in a new terminal, execute:
Please share the output from both terminals and tell us if the browser opens or not. |
browser not open . no output |
I am not sure what is wrong with your machine. Or is that terminal connected to another machine, and are you executing commands on a different VM? What happens if you try it on a different machine? If this was an actual problem, we would have many open issues. |
For the sake of completeness I setup a VM with the same OS flavor (Manjaro Linux) Operating System: Manjaro Linux
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Kernel Version: 6.9.3-3-MANJARO (64-bit)
Graphics Platform: X11
Processors: 2 × Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 3.8 GiB of RAM
Graphics Processor: llvmpipe
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
System Version: None and tried running the same test as well as the curl command. In both the cases, it worked fine. Note: I had to install chrome using the command So I think there's something wrong in the machine in question. |
What happened?
Basic code of selenium failed to start.
I tried code
Code 1
I get error message:
Code 2
get error message
How can we reproduce the issue?
Relevant log output
Operating System
Manjaro Linux Wynsdey 24.0.2 x86_64
Selenium version
4.22.0
What are the browser(s) and version(s) where you see this issue?
Google Chrome 126.0.6478.126
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 126.0.6478.126 (d36ace6122e0a59570e258d82441395206d60e1c-refs/branch-heads/6478@{#1591})
Are you using Selenium Grid?
no
Other info
hosts file contains
127.0.0.1 localhost
The text was updated successfully, but these errors were encountered: