Closed tangerinehuge closed 4 years ago
This now doesn't boot up for me but seems stuck in the start process before it even starts chrome. Ctrl+C shows the following stack trace
$ python whole_foods_delivery_slot_chrome_autobuy.py
^CTraceback (most recent call last):
File "whole_foods_delivery_slot_chrome_autobuy.py", line 144, in <module>
getWFSlot('https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1')
File "whole_foods_delivery_slot_chrome_autobuy.py", line 53, in getWFSlot
driver = webdriver.Chrome(options=chrome_options)
File "/opt/anaconda3/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "/opt/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/opt/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/opt/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
response = self.command_executor.execute(driver_command, params)
File "/opt/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 374, in execute
return self._request(command_info[0], url, body=data)
File "/opt/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 397, in _request
resp = self._conn.request(method, url, body=body, headers=headers)
File "/opt/anaconda3/lib/python3.7/site-packages/urllib3/request.py", line 80, in request
method, url, fields=fields, headers=headers, **urlopen_kw
File "/opt/anaconda3/lib/python3.7/site-packages/urllib3/request.py", line 171, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/opt/anaconda3/lib/python3.7/site-packages/urllib3/poolmanager.py", line 330, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/opt/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "/opt/anaconda3/lib/python3.7/http/client.py", line 1336, in getresponse
response.begin()
File "/opt/anaconda3/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/opt/anaconda3/lib/python3.7/http/client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/opt/anaconda3/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
KeyboardInterrupt
Shoot, sorry, that was my fault. I've been debugging it using chrome's remote debugging feature and I forgot to disable it. I've updated the code and checked in the new version. Give it another try.
Added some new code to detect if you're running chrome in remote debugging mode. If you launched chrome with the --remote-debugging-port=9222 flag then it will attach to your existing chrome session. Otherwise it will launch a new chrome session and attach to that.
It gets to the purchasing page (where you select credit card and stuff) and then doesn't click the last button, just showing "Error occured, cannot place order." in the console
Works ok on my machine but I added some logging to the script to catch whatever exception is causing it to not click the purchase button. Try the new version and send me the output if it breaks again.
I managed to manually click the button right after it failed and don't have a cart to try and reproduce with anymore unfortunately. Will report back for my next order but not sure when that's going to be.
Thank you very much for this tool, I wouldn't have had a chance of ordering without it.
thanks a lot for working on this. :) closing this pull request. I have implemented autobuy and tested it rigorously on all the three platforms. It also sticks to the Python version of the remaining repo.
No worries! I think I’m going to spin mine off into its own repo. I added a GUI and I’m working on turning it into a standalone app.
@tangerinehuge I was waiting on this, but it seems this PR did not make it to master either. Do you maintain a fork, with this now? Can I clone and try from there?
I spun mine off into a new repo since it's diverged so much from the original: https://github.com/tangerinehuge/whole-foods-autobuy
I need to update the readme still but if you're just looking for the executable I added a self-contained binary in the "mac binary" folder. It requires chrome at the moment.
This version will automatically download and install the chromedriver and then pops up a GUI with instructions and optional configurable settings. Let me know you see any bugs.
Thanks!
Thanks @tangerinehuge I'll track your repo for updates then. I am interested in running the code more than the binary. Maybe I can contribute back sth useful once you update.
Made some minor updates to handle the ElementClickInterceptedException error people were seeing and updated the readme.md file to remove the conflict created by the new step 5 image filename.