Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get SLOTS OPEN and then exception when item out of stock #54

Closed
amohap2 opened this issue Apr 21, 2020 · 8 comments
Closed

Get SLOTS OPEN and then exception when item out of stock #54

amohap2 opened this issue Apr 21, 2020 · 8 comments

Comments

@amohap2
Copy link

amohap2 commented Apr 21, 2020

The script reaches SLOTS OPEN and then hits an exception when it reaches this page, which is very common. When an item(s) goes out of stock and amazon pulls the item from the cart:

SLOTS OPEN!
Found a slot but it got taken, run script again.
Traceback (most recent call last):
File "whole_foods_delivery_autobuy.py", line 130, in
getWFSlot('https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1')
File "whole_foods_delivery_autobuy.py", line 127, in getWFSlot
autoCheckout(driver)
File "whole_foods_delivery_autobuy.py", line 33, in autoCheckout
slot_continue_button = driver.find_element_by_xpath('/html/body/div[5]/div[1]/div/div[2]/div/div/div/div/div[2]/div[3]/div/span/span/span/input')
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[5]/div[1]/div/div[2]/div/div/div/div/div[2]/div[3]/div/span/span/span/input"}
(Session info: chrome=81.0.4044.113)

https://puu.sh/FAzq4/e184453bce.png

@amohap2
Copy link
Author

amohap2 commented Apr 21, 2020

yeah i did.
page_source.zip

@pcomputo
Copy link
Owner

pushed the latest changes. Thank you for this.

@amohap2
Copy link
Author

amohap2 commented Apr 21, 2020

I don't think the issue was resolved.

refreshed
refreshed
refreshed
SLOTS OPEN!
Found a slot but it got taken, run script again.
Traceback (most recent call last):
File "whole_foods_delivery_autobuy.py", line 135, in
getWFSlot('https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1')
File "whole_foods_delivery_autobuy.py", line 132, in getWFSlot
autoCheckout(driver)
File "whole_foods_delivery_autobuy.py", line 36, in autoCheckout
slot_continue_button = driver.find_element_by_xpath('//[@id="shipoption-select"]/div/div/div/div/div[2]/div[3]/div/span/span/span/input')
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//
[@id="shipoption-select"]/div/div/div/div/div[2]/div[3]/div/span/span/span/input"}
(Session info: chrome=81.0.4044.113)

https://puu.sh/FABZG/7e766190a1.png

source.zip

@pcomputo
Copy link
Owner

ah dang! my bad. Added the proper check. thank you.

@amohap2
Copy link
Author

amohap2 commented Apr 22, 2020

Not fixed yet. I think.

SLOTS OPEN!
Found a slot but it got taken, run script again.
Traceback (most recent call last):
File "whole_foods_delivery_autobuy.py", line 141, in
getWFSlot('https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1')
File "whole_foods_delivery_autobuy.py", line 138, in getWFSlot
autoCheckout(driver)
File "whole_foods_delivery_autobuy.py", line 42, in autoCheckout
slot_continue_button = driver.find_element_by_xpath('/html/body/div[5]/div[1]/div/div[2]/div/div/div/div/div[2]/div[3]/div/span/span/span/input')
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Users/amol/.pyenv/versions/2.7.16/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[5]/div[1]/div/div[2]/div/div/div/div/div[2]/div[3]/div/span/span/span/input"}
(Session info: chrome=81.0.4044.122)

https://puu.sh/FAUUh/9e069083ec.png

source.zip

@amohap2
Copy link
Author

amohap2 commented Apr 22, 2020

you should check for url change because as it refreshes you could get redirected to amazon.com/gp/buy/itemselect/...

@pcomputo
Copy link
Owner

no not really. I increased the wait times. I dont see this issue on my end.

@amohap2
Copy link
Author

amohap2 commented Apr 22, 2020

I'll try to replicate and post the video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants