You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:无法通过Python3启动Selenium Safari WebDriver

Hey there! Let's troubleshoot this Safari + Selenium issue together. Even though you didn't share the exact error message, I've run into similar problems with Safari 11.x and Selenium 3.x before, so here are the most common fixes to try:

Troubleshooting Safari WebDriver Issues with Selenium 3.10.0 & Python 3.5

1. Verify WebDriver-Browser Version Match

Safari's WebDriver is tightly linked to the browser's version. Since you're on Safari 11.0.3, double-check that the WebDriver extension you installed matches this exact version:

  • Open Safari > Preferences > Extensions
  • Look at the version listed for SafariDriver
  • If it doesn't align with 11.0.3, grab the matching version from Apple's official Safari WebDriver resources

2. Reset Remote Automation Permissions

Sometimes the "Allow Remote Automation" setting doesn't stick properly. Try resetting it:

  • Close Safari completely
  • Open Terminal and run this command:
    defaults write com.apple.Safari IncludeDevelopMenu -bool true
  • Reopen Safari, go to the Develop menu, uncheck "Allow Remote Automation", then re-check it
  • Quit and restart Safari one more time

3. Upgrade Selenium to a More Compatible Version

Selenium 3.10.0 is a bit outdated, and later releases fixed several Safari 11 compatibility bugs. Upgrade Selenium with this terminal command:
pip install --upgrade selenium
Aim for version 3.141.0 or higher, which has improved support for older Safari versions.

4. Test with Minimal Working Code

Make sure your code is correctly initializing the Safari driver. Test with this minimal script first to rule out script-specific issues:

from selenium import webdriver

# Initialize Safari driver
driver = webdriver.Safari()
# Navigate to a test page
driver.get("https://www.google.com")
# Print page title to confirm it works
print(driver.title)
# Close the browser
driver.quit()

5. Check System Automation Permissions

On macOS, permission issues can block WebDriver from working:

  • Open System Preferences > Security & Privacy > Privacy > Automation
  • Ensure your terminal (or IDE, like PyCharm) is checked under "Allow the apps below to control your computer"
  • Also confirm Safari is listed with the necessary permissions

If you can share the exact error message you're seeing, I can narrow this down even further!


内容的提问来源于stack exchange,提问作者Lumi Wang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:14:39