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

why the program hold and not to continue run? #2216

Closed
btdan opened this issue Mar 2, 2025 · 2 comments
Closed

why the program hold and not to continue run? #2216

btdan opened this issue Mar 2, 2025 · 2 comments

Comments

@btdan
Copy link

btdan commented Mar 2, 2025

Hello,I install selenium and geckodriver on Ubuntu24.04 system.
and then write the test program as follows:

from selenium import webdriver
from selenium.webdriver.firefox.service import Service

geckodriver_path = '/usr/bin/geckodriver'
firefox_options = webdriver.FirefoxOptions()
firefox_options.add_argument('-headless') # 无头模式,不显示浏览器窗口

try:
print("开始创建 Firefox Service 对象")
# 使用 Service 类来指定驱动程序的路径
service = Service(executable_path=geckodriver_path)
print("Firefox Service 对象创建成功")

print("开始创建 Firefox 浏览器实例")
browser = webdriver.Firefox(service=service, options=firefox_options)
print("Firefox 浏览器实例创建成功")

print("开始访问百度网站")
browser.get("http://www.baidu.com")
print("成功访问百度网站")

print("开始关闭浏览器")
browser.quit()
print("浏览器已关闭")

except Exception as e:
print(f"发生错误: {e}")

when I run the program .The program hold after print("开始创建 Firefox 浏览器实例").
That is to say, It is held on the setence: browser = webdriver.Firefox(service=service, options=firefox_options)
without anything tip.
Can anyone tell me how to solve this problem?
Thanks very much.

@cgoldberg
Copy link

This was already reported to the selenium project and probably isn't a geckodriver issue:
SeleniumHQ/selenium#15356

@whimboo
Copy link
Collaborator

whimboo commented Mar 12, 2025

Thanks for the hint that it was posted twice. Let me close the issue for now, but I'm happy to reopen if it turns out to be a problem with geckodriver.

@whimboo whimboo closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2025
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

No branches or pull requests

3 participants