我想使用Selenium运行Firefox浏览器驱动程序,以便在网络爬虫中使用请求免登录。我从这个stackoverflow解决方案链接得到了灵感,因为由于多种原因使用请求进行登录不起作用。我总是会收到一个错误,浏览器无法启动,因为权限被拒绝了。下面是我的代码:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary=FirefoxBinary("/path/to/firefox")
fp=webdriver.FirefoxProfile("path/to/extra/profile")
url="www.python.org"
driver = webdriver.Firefox(fp, firefox_binary=binary, executable_path="path/to/geckodriver.exe")
driver.get(url)
错误如下:
selenium.common.exceptions.WebDriverException: Message: Failed to start browser:
permission denied
有人可以帮忙吗?我在互联网上搜索了多年,但仍然找不到任何东西...谢谢!!!
driver = webdriver.Firefox()
而不是使用Profile
?还是出现同样的问题了吗? - Andersson