1、执行webdriver.firefox()报错,提示:

WebDriverException: Message: "Can't load the profile. Profile Dir: c:\\users\\XXXXXXX\\appdata\\local\\temp\\tmpx3cssb

经过查找资料定位问题是由于启动firefox时,找不到profile配置文件导致的。

2、查找profile路径,在运行中输入:firefox -profilemanager

找到默认的profile的路径:C:\Users\XXXXX\AppData\Roaming\Mozilla\Firefox\Profiles\me5e9ib9.default

3、通过查看D:\autotest\Python27\Lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\firefox\firefox_profile.py

貌似实现原理为:如果未指定profile,则selenium新建一个新的profile,新建的profil存在于该路径下:c:\\users\\XXXXXXX\\appdata\\local\\temp\\

4、设置启动profile:

self.profileDir = "D:\\autotest\\PythonCase\\src\\selenium_test\\firefox.selenium"
        self.profile = webdriver.FirefoxProfile(self.profileDir)
        self.driver = webdriver.Firefox(self.profile)

任然报上述错误,查找各种资料均未解决,后来发现c:\\users\\XXXXXXX\\appdata\\local\\temp\\tmpx3cssb目录下多了一级子目录webdriver-py-profilecopy

解决方法:在D:\autotest\PythonCase\src\selenium_test\firefox.selenium目录下新增一级子目录,已经解决改问题

webdriver无法打开firefox的更多相关文章

  1. webdriver学习笔记(一):webdrive脚本打开firefox浏览器,报“AttributeError: module 'selenium.webdriver' has no attribu

    按照网上提供的方法: 下载geckodriver之后解压缩到 Firefox安装目录 下 添加 Firefox安装目录 到 系统变量Path 重启pycharm 照此步骤执行后,仍然报同样的错.折腾了 ...

  2. 【总结】selenium webdriver 远程连接firefox和IE 环境搭建

    参考链接:http://code.google.com/p/selenium/wiki/Grid2 本地环境为:win7,eclipse,jdk 1.7,本机ip为192.168.0.30 1.下载所 ...

  3. 【转发】Webdriver使用自定义Firefox Profile运行测试

    点击进入转发地址: 一般我们使用如下代码启动Firefox: 这样Selenium Server启动的Firefox将是一个全新的,不安装任何Add-On的Firefox. 如果有需要,我们可以使用我 ...

  4. selenium在Eclipse中打开fireFox浏览器是报报错connect to host 127.0.0.1 on port 7055

    1.相信很多同学刚接触selenium时,在Eclipse中打开fireFox浏览器是报报错: org.openqa.selenium.firefox.NotConnectedException: U ...

  5. 虚拟机安装Ubuntu14.04打开FireFox提示Server not found

    虚拟机安装Ubuntu14.04打开FireFox提示Server not found 我采用VMware安装ubuntu14.04的,VMware的网络是配置采用NAT模式(用于共享主机的IP地址) ...

  6. (java)selenium webdriver学习--打开新窗口,并判断新窗口是否与目标窗口一致

    描述:selenium webdriver学习--打开新窗口,并判断新窗口是否与目标窗口一致,若一致则切换到该窗口并获取标题 跳出if判断,获取父级标题,并关闭 HTML标签不太明显时,可以用路径表示 ...

  7. webdrive脚本打开firefox浏览器,报“AttributeError: module 'selenium.webdriver' has no attribu

    按照网上提供的方法: 下载geckodriver之后解压缩到 Firefox安装目录 下 添加 Firefox安装目录 到 系统变量Path 重启pycharm 照此步骤执行后,仍然报同样的错.折腾了 ...

  8. Selenium2(WebDriver)总结(二)---Firefox的firebug插件参数设置(补充)

    本文是对上一节的补充:http://www.cnblogs.com/puresoul/p/4251536.html 使用Selenium2(webdriver)启动firefox且自动加载firebu ...

  9. Python+Selenuim测试网站,只能打开Firefox浏览器却不能打开网页的解决方法

    最开始我使用的Selenium版本为2.48,Firefox版本为37,自动化打开网站的时候,可以正常打开. 后来由于Firefox的自检测更新,版本更新为47,导致版本不兼容,自动化打开网站浏览器时 ...

随机推荐

  1. django_cms安装技巧

    首先python的版本要高一些,否则安装django-cms会报错 安装cmsinstaller不能够正常下载 利用virtualenv进行安装配置 注意中文的配置 djangocms配置中文 dja ...

  2. 发布一个开源极致的javascript模板引擎tpl.js

    tpl.js(大家直接去https://git.oschina.net/tianqiq/tpl.js这个上面看) 简介 tpl.js是一个比较极致(极小,极快,极简单)的js模板引擎,可以在各种js环 ...

  3. Eclipse打JAR包,插件Fat Jar的安装与使用

    Eclipse可以安装一个叫Fat Jar的插件,用这个插件打包非常方便,Fat Jar的功能非常强大首先要下载Fat Jar,下载地址:https://sourceforge.net/project ...

  4. java.nio.file.Path

    public interface Path extends Comparable<Path>, Iterable<Path>, Watchable 1. A Path repr ...

  5. j.APR连接器整体框图(含SSL实现分析)

    APR连接器的思路和bio,nio的整体架构也是类似的,可以看到下面的整体框图: 第一个区别是,对于从Acceptor线程中的socket解析这块,无论是nio还是bio都是在Acceptor线程内直 ...

  6. SQL函数之---DECODE函数

    Decode函数是oracle/SQL提供的特有函数计算方式,语法:DECODE(value,if1,then1,if2,then2,if3,then3,...else),通常我们在写语句的时候可能会 ...

  7. Hibernate连数据库

    1.建数据库,建表(一定要设主码) create database Hibernate create table Students( sno char(10) primary key, sna cha ...

  8. linux rpm -ivh MySQL-server-5.5.31-2.el6.i686.rpm

    linux rpm 安装mysql异常: [root@localhost upload]# rpm -ivh MySQL-server-5.5.31-2.el6.i686.rpmerror: Fail ...

  9. 更改make/bison的版本

    一.make版本 1.下载make的压缩包 ftp://ftp.gnu.org/gnu/make/ 2.解压,安装 cd make-x.x ./configuration sh build.sh su ...

  10. JavaWeb前端:JQuery

    Jquery基本概念 什么是Jquery Jquery是一个开源的,集成了Javascript,CSS,DOM,AJAX的前端框架:它诞生于2006年,最初是为了简化JavaScript开发而产生的, ...