摘要:1、中文编码问题报错提示:SyntaxError: Non-ASCII character '\xba' in file D:\autotest\PythonCase\src\selenium\test.py on line 10, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details解决方法:在脚本的第一行(必须是第一行)加入:# -*- coding: utf-8 -*-2、包名称问题报错提示: from selenium import webdriver Imp
阅读全文
摘要: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\Fir
阅读全文
摘要:Python Version 2.7 required, which was not found in the registry新建注册表信息:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath修改默认数据为:python2.7的主目录
阅读全文
摘要:1、下载chrome,下载chrome driver,下载地址:http://code.google.com/p/chromedriver/downloads/list2、安装chrome,默认路径:C:\Program Files\Google\Chrome\Application3、将下载好的chrome driver放到C:\Program Files\Google\Chrome\Application目录下4、设置系统环境变量,在path目录中增加路径:C:\Program Files\Google\Chrome\Application新建python脚本:from selenium
阅读全文
摘要:1、安装python-2.7.3.msi2、安装pywin32-216.win32-py2.7.exe3、下selenium包,selenium-2.35.0.tar.gz,放到D:\autotest\Python27\Lib\site-packages目录下,并解压到selenium压缩包下执行:python setup.py install4、下载selenium-server-standalone-2.35.0.jar5、在python中执行from selenium import webdriver如果无报错,说明selenium安装成功
阅读全文