ningruolily

导航

selenium+python+eclipse开发中遇到的问题

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
ImportError: cannot import name webdriver

解决方法:通过import selenium  print selenium.__file__得出import的selenium的路径为:D:\autotest\PythonCase\src\selenium\__init__.pyc,而该路径为创建包的时候,因为包名为selenium。

 

 

 

posted on 2014-03-19 11:41  ningruolily  阅读(344)  评论(0编辑  收藏  举报