-
Notifications
You must be signed in to change notification settings - Fork 804
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
"You have no items in cart." when screenshot clearly shows item in cart #798
Comments
oops, I was looking at a different section of the code, deep within navigate_pages(), where the self.get_cart_count() happens before a PTC button check. I stand corrected, I dont think this is what is happening, the actual logic is in handle_cart() this is the part that confused me: good eye, the screenshot is cut off because thats how big the chrome window happened to be when the screenshot was taken, so in reality I have no idea what the cart icon number shows. I have since made the window bigger. @DakkJaniels do you think its possible the client side js on the amazon page simply doesnt update the dom element for the cart to 1 if its not visible? is the cart number loaded asynchronously? is it possible there is a rare asynchronous condition where self.get_amazon_element(key="PTC") is not found, and self.get_cart_count() == 0 and the page fully loads right before the screenshot is taken? like here between lines 1420 and 1421. maybe i just had really bad luck and got caught in that tiny millisecond window where the dom was not fully loaded? |
closing this issue, i cannot reproduce this. I have since successfully clicked the Proceed to Checkout button many times without this error. I think this issue still exists, but there is only a very tiny window of race condition where this can happen. |
guys im reopening this because it happened again. screenshot no-items and an item is in the cart. this time I was able to capture the fact that the cart number on the top right is indeed == 0. this happens very rarely, I would say I was able to add to cart maybe 50 or 60 times before this happened once. there must be some kind of async page loading race condition where the number is 0 for a split second. I think we should continue checking for the PTC button until the timeout, and maybe dont bother with checking if self.get_cart_count() == 0 and early exit ? what do you guys suggest? |
Then it will sit there for 5-10 seconds until the timeout occurs, which also not something you would want to happen. Probably makes sense to just set a flag once it hits it the first time, then waits a half a second before it breaks the loop. |
This only ever happened once, so i cant reproduce it, but fairgame managed to add an item to the cart, and got to the cart page, and the "Proceed to Checkout"(PTC) button is available, but somehow the "You have no items in cart. Going back to stock check."
see this screenshot that was taken.
notice the filename is "screenshot-no-items_05-28-2021_15_27_08"
what this tells me is somehow self.get_cart_count() == 0, even though clearly an item is in the cart.
its possible the state of the cart icon on the top right shows 0, even though the item is in the cart. is there a reason for this sanity check? its possible if we detect the PTC(Proceed to checkout) button, we should try and click it regardless of what self.get_cart_count() returns?
specifically this check :
https://github.com/Hari-Nagarajan/fairgame/blob/master/stores/amazon.py#L1123
The text was updated successfully, but these errors were encountered: