python selenium webdriver问题(selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件.配置文件目录:") [英] python selenium webdriver issue ( selenium.common.exceptions.WebDriverException: Message: "Can't load the profile. Profile Dir: )

查看:183
本文介绍了python selenium webdriver问题(selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件.配置文件目录:")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mac OS X 10.8.3,硒2.32.0,python 2.7,Firefox 20,并且在运行python绑定时遇到此错误:

I'm using Mac OS X 10.8.3, selenium 2.32.0, python 2.7, Firefox Version 20 and have been getting this error when running the python binding:

selenium.common.exceptions.WebDriverException: 
    Message: "Can't load the profile. Profile Dir: /var/folders/vn/8h6w79td4p59l9h9xhx2986r0000gn/T/tmpTmsdul Firefox output:  LOG addons.xpi: startup
    LOG addons.xpi: Skipping unavailable install location app-system-share
    LOG addons.xpi: checkForChanges
    LOG addons.xpi: No changes found
    2013-04-11 21:59:09.107 firefox-bin[26167:707] invalid drawable"

Firefox打开,但不加载我在python硒脚本中提供的URL.我已经看到很多其他人都遇到过这样的问题,例如这篇文章:

Firefox opens, but doesn't load the url that I've supplied in my python selenium script. I've seen many others with this issue like this post:

post from stackoverflow

但是我可以追溯到我在本地主机上运行本地开发站点的事实.在我的主机文件中设置了它:

But I've tracked it down to the fact that I am running a local development site off localhost. In my hosts file I have it set:

127.0.0.1 local.development.com

当我将其更改回原始版本时:

When I change it back to the original:

127.0.0.1 localhost

一切正常.现在,只需编辑我的主机文件即可在此本地开发站点和Selenium之间切换,这很容易.但是想问一问我是否可以保持本地开发站点正常运行并仍然同时使用硒.

Everything works great. Now it's easy to just edit my hosts file to switch between this local development site and selenium. But wanted to ask if there was a way I can keep my local development site up and running and still use selenium at the same time.

任何建议或详细信息.也许也可以对内部运作方式做一些解释?预先感谢.

Any suggestions or details. Maybe some explanation of the internal workings too, please? Thanks in advance.

推荐答案

您需要在hosts文件中输入localhost的条目.但是您可以添加local.development.com.

You need the entry for localhost in your hosts file. But you can add your local.development.com.

因此请确保您拥有:

127.0.0.1 localhost
127.0.0.1 local.development.com

在您的主机文件中.而不只是一个或另一个.主机文件是从域名到IP地址的映射.您可以有许多指向相同IP地址的域名.但是Selenium明确尝试连接到"localhost".您已经删除了该条目.

In your hosts file. Rather than just one or the other. The hosts file is a mapping from domain names to IP addresses. You can have lots of domain names that point to the same IP address. But Selenium explicitly tries to connect to 'localhost'. And you had deleted that entry.

这篇关于python selenium webdriver问题(selenium.common.exceptions.WebDriverException:消息:“无法加载配置文件.配置文件目录:")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆