NeweggBot icon indicating copy to clipboard operation
NeweggBot copied to clipboard

Cannot find the Place Order button

Open crash087 opened this issue 5 years ago • 8 comments

Bot finds and adds item to cart, then errors out stating it cant find the place order button. Not sure if it has anything to do with chrome (also tried chromium) being zoomed in and cutting off the right half of the page (also cant scroll left/right)

I tried changing the browser executable path to firefox to see if that helps , but i get a different error then before it even gets anywhere. If i change it to firefox it will launch firefox but somehow it cant connect to anything. command prompt shows "Error: Failed to launch the browser process!"

is there something obvious im missing, or am i just that good at breaking things lol

crash087 avatar Dec 21 '20 09:12 crash087

update, it i put a break in the code where it clicks the proceed to secure checkout button, and close the kn95 mask popup, and then start the bot again, it works. Apparently that popup is somehow hiding the checkout button. Never used javascript before, but im going to attempt to find a way to close it automatically, even if its just ghetto rigged sendkey statements...or whatever the javascript equivalent is

crash087 avatar Dec 22 '20 04:12 crash087

@crash087 check out this PR, should address the mask popup issue:

https://github.com/Ataraksia/NeweggBot/pull/35

Feel free to test my fork of this repo until this gets merged.

wcedmisten avatar Dec 24 '20 18:12 wcedmisten

@crash087 check out this PR, should address the mask popup issue:

#35

Feel free to test my fork of this repo until this gets merged.

not seeing the mask pop up, but its just looping and repeatedly adding the item to the cart without ever going to checkout

crash087 avatar Dec 29 '20 20:12 crash087

Could you provide logs from the console when this happens? I'm not able to reproduce this on my branch. I've only tested this with "auto_submit":"false", so I'm not 100% sure a purchase goes through, but I can't reproduce the looping behavior.

wcedmisten avatar Jan 01 '21 00:01 wcedmisten

For me, the successful logs look like this:

$ node NeweggBot.js 
Thu Dec 31 2020 19:30:45 : Started
Thu Dec 31 2020 19:30:56 : Manual authorization code required by Newegg.  This should only happen once.
Thu Dec 31 2020 19:32:04 : Logged in
Thu Dec 31 2020 19:32:04 : Checking for card
Thu Dec 31 2020 19:32:07 : Card added to cart, attempting to purchase
Thu Dec 31 2020 19:32:07 : Starting Secure Checkout
Thu Dec 31 2020 19:32:14 : Completed purchase

wcedmisten avatar Jan 01 '21 00:01 wcedmisten

Thu Dec 31 2020 19:30:45 : Started Thu Dec 31 2020 19:30:56 : Manual authorization code required by Newegg. This should only happen once. Thu Dec 31 2020 19:32:04 : Logged in Thu Dec 31 2020 19:32:04 : Checking for card

and it just sits there until newegg wont let me add anymore flash drives (what i was using to test) to my cart.

although now it wont even run and says it cant find browser revision all the sudden, even tho ive changed nothing since the last run...

Edit: now it runs but even weirder is firefox doesnt launch, but it goes thru the steps like its there and tells me about the 6 digit verification pin, weirder than that (LOL) is i actually get the email from newegg with the pin... so its communicating with the site, i just cant see it, and thus, cant enter the verification pin. I havent been able to figure out why its doing that, but i did notice it opens 8 instances of firefox nightly (as background processes, not the app like it should) when i run it, at least according to task manager, i cant see them anywhere

crash087 avatar Jan 01 '21 18:01 crash087

The behavior you're seeing is because firefox is launching in headless mode, so it's controlling the browser, but doesn't render it for a human to see. I just pushed a change to force disable headless mode, so that should resolve the issue.

As for the looping, I'm guessing the code is hitting an error somewhere in these two while loops: https://github.com/Ataraksia/NeweggBot/blob/master/NeweggBot.js#L83-L123

I added some extra logging, so if you re-run the code, you should be able to see where this is failing. It's possible that the structure of the website is slightly different, so you may need to modify this code (perhaps element names) in order for this to work for the version being served to you.

wcedmisten avatar Jan 01 '21 23:01 wcedmisten

The behavior you're seeing is because firefox is launching in headless mode, so it's controlling the browser, but doesn't render it for a human to see. I just pushed a change to force disable headless mode, so that should resolve the issue.

As for the looping, I'm guessing the code is hitting an error somewhere in these two while loops: https://github.com/Ataraksia/NeweggBot/blob/master/NeweggBot.js#L83-L123

I added some extra logging, so if you re-run the code, you should be able to see where this is failing. It's possible that the structure of the website is slightly different, so you may need to modify this code (perhaps element names) in order for this to work for the version being served to you.

it all seems to be working, aside from the refresh timer, its spamming refresh ever second-second and a half.. I tried to update it to randomly pick a delay between 5 and 20 seconds between trying to add the item to cart again, but got some error (this is my first time playing with javascript, so i have almost no idea what im doing haha)

crash087 avatar Jan 02 '21 20:01 crash087