程序如下:
#coding=utf-8
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time, re
from Public import login
from Public import url
import xml.dom.minidom
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver import Remote
======================================================================
ERROR: test_enbrel_login (__main__.EnbrelLogin)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python34\lib\urllib\request.py", line 1183, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "C:\Python34\lib\http\client.py", line 1137, in request
self._send_request(method, url, body, headers)
File "C:\Python34\lib\http\client.py", line 1182, in _send_request
self.endheaders(body)
File "C:\Python34\lib\http\client.py", line 1133, in endheaders
self._send_output(message_body)
File "C:\Python34\lib\http\client.py", line 963, in _send_output
self.send(msg)
File "C:\Python34\lib\http\client.py", line 898, in send
self.connect()
File "C:\Python34\lib\http\client.py", line 871, in connect
self.timeout, self.source_address)
File "C:\Python34\lib\socket.py", line 516, in create_connection
raise err
File "C:\Python34\lib\socket.py", line 507, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\enbrel_login\login_case\enbrel_login.py", line 29, in setUp
self.driver = url.browser(self)
File "C:\Python34\enbrel_login\login_case\Public\url.py", line 23, in browser
'javascriptEnabled':True,
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 401, in execute
return self._request(command_info[0], url, body=data)
File "C:\Python34\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 469, in _request
resp = opener.open(request, timeout=self._timeout)
File "C:\Python34\lib\urllib\request.py", line 464, in open
response = self._open(req, data)
File "C:\Python34\lib\urllib\request.py", line 482, in _open
'_open', req)
File "C:\Python34\lib\urllib\request.py", line 442, in _call_chain
result = func(*args)
File "C:\Python34\lib\urllib\request.py", line 1211, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Python34\lib\urllib\request.py", line 1185, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>