gpt4 book ai didi

python - selenium.common.exceptions.WebDriverException : Message: Can not connect to the Service/usr/bin/safaridriver

转载 作者:行者123 更新时间:2023-12-02 02:26:41 48 4
gpt4 key购买 nike

基本上,在我的 Mac 上,selenium 不起作用。我的代码是这样的:

from selenium import webdriver
webdriver.Safari('/usr/bin/safaridriver')

这实际上是最基本的 Selenium 脚本,但它不起作用......程序运行 30 秒后,出现以下错误:selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service/usr/bin/safaridriver。我不知道为什么会发生这种情况...我的 safari 版本是最新的(14.0.1),但我不断收到此错误。感谢您的帮助!

最佳答案

传递给 webdriver.Safari 的第一个位置参数不是 executable_path 参数,而是 port 参数。您必须将路径作为位置参数传递。

webdriver.Safari(executable_path='/usr/bin/safaridriver')

关于python - selenium.common.exceptions.WebDriverException : Message: Can not connect to the Service/usr/bin/safaridriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65545829/

48 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com