小测试一枚
还没有,不知道问题出在哪~
刚查了端口号使用情况,没发现被占用~
Traceback (most recent call last):
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\util\connection.py", line 79, in create_connection
raise err
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\util\connection.py", line 69, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File "D:\Programs\Python\Python35\lib\http\client.py", line 1107, in request
self._send_request(method, url, body, headers)
File "D:\Programs\Python\Python35\lib\http\client.py", line 1152, in _send_request
self.endheaders(body)
File "D:\Programs\Python\Python35\lib\http\client.py", line 1103, in endheaders
self._send_output(message_body)
File "D:\Programs\Python\Python35\lib\http\client.py", line 934, in _send_output
self.send(msg)
File "D:\Programs\Python\Python35\lib\http\client.py", line 877, in send
self.connect()
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connection.py", line 196, in connect
conn = self._new_conn()
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connection.py", line 180, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/PycharmProjects/mommonNewH5/LYnewH5/testCase/testMainTransfer.py", line 22, in setUp
self.driver = ChromeDriver(self.d).driver()
File "..\chromedriver.py", line 59, in driver
dr = webdriver.Remote('http://localhost:%d' % self.port, capabilities)
File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init_
self.start_session(capabilities, browser_profile)
File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 318, in execute
response = self.command_executor.execute(driver_command, params)
File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 375, in execute
return self._request(command_info[0], url, body=data)
File "D:\Programs\Python\Python35\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 402, in _request
resp = http.request(method, url, body=body, headers=headers)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\request.py", line 72, in request
**urlopen_kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\request.py", line 150, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\poolmanager.py", line 322, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
**response_kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
**response_kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
**response_kw)
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:\Programs\Python\Python35\lib\site-packages\urllib3\util\retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=9515): Max retries exceeded with url: /session (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',))
这是什么情况?好像执行到 self.driver = ChromeDriver(self.d).driver() 就报错了
'WebDriver' object has no attribute 'contexts' 我也遇到了,找不到原因~
请问后来有没解决呀,我也遇到同样的问题,头痛
小测试一枚