求助:python+selenium 报错
#!/usr/bin/python# -*- coding: UTF-8 -*-
from selenium import webdriver
browser = webdriver.firefox()
browser.get("http://www.baidu.com")
browser.close()
运行后报错:
Traceback (most recent call last):
File "D:/Python27/Lib/uuu.py", line 6, in <module>
browser = webdriver.firefox()
TypeError: 'module' object is not callable
谁知道原因啊:'( 帮顶 请大写:webdriver.Firefox(),小写是错误 调用浏览器,千万不要小写。python中大写和小写有很大区别的! 一楼正解,顺便补充,如果调用火狐浏览器是webdriver.Firefox(),如果调用谷歌浏览器是webdriver.Chrome(),如果调用IE浏览器是webdriver.Ie() :) 1楼正解 很感谢大家的回复,改成大写后,仍然不行啊,报错如下:
Traceback (most recent call last):
File "D:/Python27/Lib/daxie.py", line 6, in <module>
browser = webdriver.Firefox()
File "D:\Python27\selenium\webdriver\firefox\webdriver.py", line 60, in __init__
self.binary, timeout),
File "D:\Python27\selenium\webdriver\firefox\extension_connection.py", line 45, in __init__
self.profile.add_extension()
File "D:\Python27\selenium\webdriver\firefox\firefox_profile.py", line 143, in add_extension
self._install_extension(extension)
File "D:\Python27\selenium\webdriver\firefox\firefox_profile.py", line 336, in _install_extension
shutil.rmtree(tmpdir)
File "D:/Python27/Lib\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "D:/Python27/Lib\shutil.py", line 256, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "D:/Python27/Lib\shutil.py", line 254, in rmtree
os.rmdir(path)
WindowsError: : 'c:\\users\\bj-01-~1\\appdata\\local\\temp\\tmpm_weh5.webdriver.xpi\\components' 已经倒腾了很久了,周围也没有人会:'(
页:
[1]