前提・実現したいこと
conohaのVPSでdiscord用のプログラムをpythonとseleniumを使ってページのcssセレクタを取得し変更があるかを永遠にチェックするプログラム
発生している問題・エラーメッセージ
python
1Traceback (most recent call last): 2 File "/root/test_django/lib64/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen 3 chunked=chunked) 4 File "/root/test_django/lib64/python3.6/site-packages/urllib3/connectionpool.py", line 354, in _make_request 5 conn.request(method, url, **httplib_request_kw) 6 File "/usr/lib64/python3.6/http/client.py", line 1239, in request 7 self._send_request(method, url, body, headers, encode_chunked) 8 File "/usr/lib64/python3.6/http/client.py", line 1285, in _send_request 9 self.endheaders(body, encode_chunked=encode_chunked) 10 File "/usr/lib64/python3.6/http/client.py", line 1234, in endheaders 11 self._send_output(message_body, encode_chunked=encode_chunked) 12 File "/usr/lib64/python3.6/http/client.py", line 1026, in _send_output 13 self.send(msg) 14 File "/usr/lib64/python3.6/http/client.py", line 964, in send 15 self.connect() 16 File "/root/test_django/lib64/python3.6/site-packages/urllib3/connection.py", line 181, in connect 17 conn = self._new_conn() 18 File "/root/test_django/lib64/python3.6/site-packages/urllib3/connection.py", line 168, in _new_conn 19 self, "Failed to establish a new connection: %s" % e) 20urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at ######>: Failed to establish a new connection: [Errno 111] Connection refused
該当のソースコード
python
1 wd = webdriver.Chrome() 2 url = 'https://www.nike.com/jp/launch/t/air-fear-of-god-moc-pure-platinum/' 3 wd.get(url) 4 rtn = 'カートに追加' in wd.find_element_by_css_selector('.buying-tools-container').text 5 if rtn == True and a == 0: 6 await ch.send() 7 await ch.send('商品名\r\n\r\n') 8 await ch.send(wd.find_element_by_css_selector('.ncss-brand.text-color-grey.u-uppercase.mb-1-sm.mb0-md.fs14-sm.fs16-md').text + wd.find_element_by_css_selector('.rr-title.ncss-brand.u-uppercase.fs20-sm.fs32-lg.pb2-sm').text) 9 await ch.send('価格\r\n\r\n') 10 await ch.send(wd.find_element_by_css_selector('.ncss-brand.pb6-sm.fs14-sm.fs16-md').text) 11 await ch.send('URL\r\n\r\n') 12 await ch.send(url) 13 elif wd.find_element_by_css_selector('.buying-tools-container').text == '完売' and a == 1: 14 a = 0 15 wd.close() 16 wd.quit()
補足情報(FW/ツールのバージョンなど)
python3.6.7
Google Chrome 74.0.3729.131
ChromeDriver 74.0.3729.6
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/05/03 11:03
2019/05/03 11:20