在Mac上使用Selenium和python脚本的问题(webdriver:firefox driver / geckodriver)

时间:2017-01-28 07:43:18

标签: python python-2.7 selenium firefox geckodriver

我正在尝试在我的mac上使用带有Python脚本的selenium需要firefox(并且我已经从github克隆了geckodriver)但是出于某种原因,webdriver似乎存在某种类型的问题(I知道它需要firefoxdriver& firebug,我得到了geckodriver)。我真的很喜欢菜鸟(我是一名CS学生,也是一名初学者,正在努力学习)。我觉得我的问题可能与我的Firefox配置文件不在路径中但我真的不知道。这是我得到的错误:

TableView

我找到了解决类似问题的另一个解决方案Firefox driver can't start for Selenium 3.0.1 with FF49 and Python 但在python我得到:

  
    
      来自selenium import webdriver       browser = webdriver.Firefox()       Traceback(最近一次调用最后一次):         文件"",第1行,in         文件" /Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py" ;,第103行, init           self.binary,timeout)         文件" /Library/Python/2.7/site-packages/selenium/webdriver/firefox/extension_connection.py",第51行, init           self.binary.launch_browser(self.profile,timeout = timeout)         文件" /Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py",第68行,在launch_browser中           self._wait_until_connectable(超时=超时)         文件" /Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py" ;,第106行,在_wait_until_connectable中           %(self.profile.path))       selenium.common.exceptions.WebDriverException:消息:无法加载配置文件。配置文件目录:/ var / folders / jr / 61813w490n14yrp433c8d9zr0000gn / T / tmp6f_7bG如果在FirefoxBinary构造函数中指定了log_file,请检查它是否有详细信息。

    
  

所以,如果有人可能知道我的硒与硒有什么不对。 webdriver-当我安装Selenium时出现此错误:

 File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 103, in __init__
self.binary, timeout)
 File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__
self.binary.launch_browser(self.profile, timeout=timeout)
File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser
self._wait_until_connectable(timeout=timeout)
File "/Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 106, in _wait_until_connectable
 % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile.  Profile Dir:    /var/folders/jr/61813w490n14yrp433c8d9zr0000gn/T/tmpIeQVyC If you  specified a    log_file in the FirefoxBinary constructor, check it for details.

任何帮助都会非常感激 - 我已经在互联网上搜寻了几天试图寻找解决方案&尝试各种各样的事情。

另外,我发现这个问题类似:Selenium: FirefoxProfile exception Can't load the profile但是我正在使用sudo运行脚本,而我正在使用命令pip install -U selenium(他们说这两个都是对此的修复)问题)

0 个答案:

没有答案