|
不能正常打开火狐浏览器, 是什么原因呢
# coding = utf-8
... from selenium import webdriver
>>> browser = webdriver.Firefox()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
line 85, in __init__
keep_alive=True)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l
ine 234, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connectio
n.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\remote_connectio
n.py", line 432, in _request
resp = self._conn.getresponse()
File "C:\Python27\lib\httplib.py", line 1013, in getresponse
response.begin()
File "C:\Python27\lib\httplib.py", line 402, in begin
version, status, reason = self._read_status()
File "C:\Python27\lib\httplib.py", line 360, in _read_status
line = self.fp.readline()
File "C:\Python27\lib\socket.py", line 430, in readline
data = recv(1)
socket.error: [Errno 10054]
>>> browser.get("http://www.baidu.com")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'browser' is not defined
>>> browser.find_element_by_id("kw").send_keys("selenium")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'browser' is not defined
>>> browser.find_element_by_id("su").click()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'browser' is not defined
>>> |
|