Selenium无法加载配置文件(Python)

时间:2016-09-14 19:28:30

标签: python selenium firefox

我正在尝试使用Selenium来自动化Python的一些东西,但是我无法加载网站。我一直在寻找解决方案,但关于这个主题的回答很好的文章往往是3 - 5年,我发现的答案到目前为止还没有解决。

  • 我的操作系统是Windows 8.1
  • Firefox版本为48.0.2
  • 硒版本为2.53.6
  • Python版本为3.5.2

我开始使用Selenium文档中的示例代码:

Traceback (most recent call last):
  File "linkshare_scraper.py", line 30, in <module>
    driver = webdriver.Firefox()
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\
firefox\webdriver.py", line 80, in __init__
    self.binary, timeout)
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\
firefox\extension_connection.py", line 52, in __init__
    self.binary.launch_browser(self.profile, timeout=timeout)
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\
firefox\firefox_binary.py", line 68, in launch_browser
    self._wait_until_connectable(timeout=timeout)
  File "C:\Program Files (x86)\Python35-32\lib\site-packages\selenium\webdriver\
firefox\firefox_binary.py", line 108, in _wait_until_connectable
    % (self.profile.path))
selenium.common.exceptions.WebDriverException: Message: Can't load the profile.
Profile Dir: C:\Users\Gabriel\AppData\Local\Temp\tmpsmnjuomr If you specified a lo
g_file in the FirefoxBinary constructor, check it for details.

这遗憾地导致了以下错误:

driver.findElement(By.className("android.widget.Switch"))

0 个答案:

没有答案