简体   繁体   English

Windows 7下的Selenium无法启动FirefoxDriver:无法加载配置文件

[英]Selenium under Windows 7 cannot start FirefoxDriver: Can't load profile

I see a lot of similar questions as old as mammoth crap, which minds Firefox 22 or something like that. 我看到了很多类似的问题,就像猛ma的废话一样古老,它会影响Firefox 22或类似的东西。 I faced the same issue: Can't load the profile. Profile Dir: c:\\users\\alp\\appdata\\local\\temp\\tmprcb81b 我遇到了同样的问题: Can't load the profile. Profile Dir: c:\\users\\alp\\appdata\\local\\temp\\tmprcb81b Can't load the profile. Profile Dir: c:\\users\\alp\\appdata\\local\\temp\\tmprcb81b

Unittest starts firefox, creates profile directory in %temp% succesfully, but after timeout fails with specified error message. Unittest启动firefox,成功在%temp%中创建配置文件目录,但是在超时后失败并显示指定的错误消息。 I am using latest Firefox (45.0b with multiprocessing) and Python 2.7.11 我正在使用最新的Firefox(具有多处理功能的45.0b)和Python 2.7.11

What have I tried: 我尝试了什么:

  • I tried to downgrade to version 40.0 (single processing) and delete my profile direcrtory. 我试图降级到40.0版(单一处理)并删除我的个人资料目录。 It does not works. 它不起作用。
  • I tried to upgrade Selenium to latest version ( pip install -U selemiun ). 我试图将Selenium升级到最新版本( pip install -U selemiun )。 Pip upgrades from 2.5.0 to 2.5.1 without any affects. 点数从2.5.0升级到2.5.1,没有任何影响。
  • I added log file to FirefoxBinary and it does not contains even WARN sign. 我将日志文件添加到FirefoxBinary,它甚至不包含WARN符号。 Accordingly to log it looks like Firefox starting right and stops without any reasons. 相应地,它看起来像Firefox一样可以正常启动,并且没有任何原因停止。
  • I tried to delete entire repository, get new one and re-run unit test. 我试图删除整个存储库,获取新的存储库,然后重新运行单元测试。
  • Finally I created virtual machine with Python 2.7.11, git, Firefox 40.0 cloned repo and started test again. 最终,我使用Python 2.7.11,git,Firefox 40.0克隆回购创建了虚拟机,然后再次开始测试。 With not luck. 不走运。

I am completely mad about it amd have no any ideas how to fix this issue. 我完全为之疯狂,并且对如何解决此问题一无所知。 Do you have any? 你有什么?

I still not found solution at this moment , but reasons is clear. 我还没有发现在这一刻的解决方案,但原因是显而易见的。 For that moment Firefox >=44 under Windows 7 x64 does not support injected Selenium's addon. 目前,Windows 7 x64下的Firefox> = 44不支持注入的Selenium插件。 It could be easily checked - once Firefox started (and nevertheless is invisible for selenium's engine) type about:addons and check "Extenstions" tab. 它很容易检查-Firefox启动后(尽管对于硒引擎来说是不可见的),键入about:addons并检查“扩展”选项卡。 On older version addon "WebDriver for Firefox" just marked as "unsigned and potentially dangerous". 在旧版本的附件中,“ WebDriver for Firefox”仅被标记为“未签名且可能有危险”。 On newer ones it is disabled. 在较新的版本上,它被禁用。

My current workaround (I do not want to downgrade my primary browser) is to download FireFox Portable, put it somewhere and instantiate driver with binary: 我当前的解决方法(我不想降级我的主浏览器)是下载FireFox Portable,将其放在某个位置并使用二进制实例化驱动程序:

self.driver = webdriver.Firefox(profile,    
    firefox_binary=FirefoxBinary(firefox_path=r'D:\path\to\old\crap\FireFox37\firefox.exe '))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM