こんにちは、
Google Chromeにウェブスクレイピングの練習をしていますが、二つ目のウィンドウズに問題が出てきました。
WEB上に数時間を調べたですが、解決できないので、ご協力いただきたくお願いいたします。
!pip install selenium !pip install beautifulsoup4 from selenium webdriver.chrome.service import Service import time import pandas as pd USER = "test_user" PASS = "test_pw" browser = webdriver.Chrome(service=Service("chromedriver.exe")) browser.implicitly_wait(3) #ここまでは問題なく、Jupyterで実行できます。しかし、下のコードを実行すると、エラーが出てきました。 url_login = r"https://kino-code.work/membership-login/" browser.get(url_login) time.sleep(3) print("ログインページにアクセスしました")
下記はエラー内容
--------------------------------------------------------------------------- ConnectionRefusedError Traceback (most recent call last) ~\anaconda3\lib\site-packages\urllib3\connection.py in _new_conn(self) 173 try: --> 174 conn = connection.create_connection( 175 (self._dns_host, self.port), self.timeout, **extra_kw ~\anaconda3\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options) 95 if err is not None: ---> 96 raise err 97 ~\anaconda3\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options) 85 sock.bind(source_address) ---> 86 sock.connect(sa) 87 return sock ConnectionRefusedError: [WinError 10061] 対象のコンピューターによって拒否されたため、接続できませんでした。 During handling of the above exception, another exception occurred: NewConnectionError Traceback (most recent call last) ~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 698 # Make the request on the httplib connection object. --> 699 httplib_response = self._make_request( 700 conn, ~\anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 393 else: --> 394 conn.request(method, url, **httplib_request_kw) 395 ~\anaconda3\lib\site-packages\urllib3\connection.py in request(self, method, url, body, headers) 238 headers["User-Agent"] = _get_default_user_agent() --> 239 super(HTTPConnection, self).request(method, url, body=body, headers=headers) 240 ~\anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked) 1278 """Send a complete request to the server.""" -> 1279 self._send_request(method, url, body, headers, encode_chunked) 1280 ~\anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked) 1324 body = _encode(body, 'body') -> 1325 self.endheaders(body, encode_chunked=encode_chunked) 1326 ~\anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked) 1273 raise CannotSendHeader() -> 1274 self._send_output(message_body, encode_chunked=encode_chunked) 1275 ~\anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked) 1033 del self._buffer[:] -> 1034 self.send(msg) 1035 ~\anaconda3\lib\http\client.py in send(self, data) 973 if self.auto_open: --> 974 self.connect() 975 else: ~\anaconda3\lib\site-packages\urllib3\connection.py in connect(self) 204 def connect(self): --> 205 conn = self._new_conn() 206 self._prepare_conn(conn) ~\anaconda3\lib\site-packages\urllib3\connection.py in _new_conn(self) 185 except SocketError as e: --> 186 raise NewConnectionError( 187 self, "Failed to establish a new connection: %s" % e NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000001BDE7FB9EB0>: Failed to establish a new connection: [WinError 10061] 対象のコンピューターによって拒否されたため、接続できませんでした。 During handling of the above exception, another exception occurred: MaxRetryError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_8600/1569864947.py in <module> 1 url_login = r"https://kino-code.work/membership-login/" ----> 2 browser.get(url_login) 3 time.sleep(3) 4 print("ログインページにアクセスしました") ~\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in get(self, url) 434 Loads a web page in the current browser session. 435 """ --> 436 self.execute(Command.GET, {'url': url}) 437 438 @property ~\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params) 420 421 params = self._wrap_value(params) --> 422 response = self.command_executor.execute(driver_command, params) 423 if response: 424 self.error_handler.check_response(response) ~\anaconda3\lib\site-packages\selenium\webdriver\remote\remote_connection.py in execute(self, command, params) 419 data = utils.dump_json(params) 420 url = f"{self._url}{path}" --> 421 return self._request(command_info[0], url, body=data) 422 423 def _request(self, method, url, body=None): ~\anaconda3\lib\site-packages\selenium\webdriver\remote\remote_connection.py in _request(self, method, url, body) 441 442 if self.keep_alive: --> 443 resp = self._conn.request(method, url, body=body, headers=headers) 444 statuscode = resp.status 445 else: ~\anaconda3\lib\site-packages\urllib3\request.py in request(self, method, url, fields, headers, **urlopen_kw) 76 ) 77 else: ---> 78 return self.request_encode_body( 79 method, url, fields=fields, headers=headers, **urlopen_kw 80 ) ~\anaconda3\lib\site-packages\urllib3\request.py in request_encode_body(self, method, url, fields, headers, encode_multipart, multipart_boundary, **urlopen_kw) 168 extra_kw.update(urlopen_kw) 169 --> 170 return self.urlopen(method, url, **extra_kw) ~\anaconda3\lib\site-packages\urllib3\poolmanager.py in urlopen(self, method, url, redirect, **kw) 373 response = conn.urlopen(method, url, **kw) 374 else: --> 375 response = conn.urlopen(method, u.request_uri, **kw) 376 377 redirect_location = redirect and response.get_redirect_location() ~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 781 "Retrying (%r) after connection broken by '%r': %s", retries, err, url 782 ) --> 783 return self.urlopen( 784 method, 785 url, ~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 781 "Retrying (%r) after connection broken by '%r': %s", retries, err, url 782 ) --> 783 return self.urlopen( 784 method, 785 url, ~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 781 "Retrying (%r) after connection broken by '%r': %s", retries, err, url 782 ) --> 783 return self.urlopen( 784 method, 785 url, ~\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 753 e = ProtocolError("Connection aborted.", e) 754 --> 755 retries = retries.increment( 756 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] 757 ) ~\anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 572 573 if new_retry.is_exhausted(): --> 574 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 575 576 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry) MaxRetryError: HTTPConnectionPool(host='localhost', port=59061): Max retries exceeded with url: /session/91bc57fc3cd82d53fd5c4cc5fefea3cb/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001BDE7FB9EB0>: Failed to establish a new connection: [WinError 10061] 対象のコンピューターによって拒否されたため、接続できませんでした。'))
以上、よろしくお願いいたします。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。