0

So I'm testing a bot I've created using Python with Selenium on the Amazon website.

When the bot opens the browser on the Amazon product page, I'm greeted with a "Select Your Cookies Preference" slide-up pop-up at the bottom of my window.

I can use my Selenium bot to click the "Accept Cookies" button and then click the "Add to Cart" button, which I coded without any issues - but my question is, can I bypass clicking the "Accept Cookies" button and go straight to clicking the "Add to Cart" button behind this Cookies slide-up pop-up?

I know I can click on "Add to Cart" without hitting "Accept Cookies" when I manually use the website, but can my bot do this? If so, how? Because I tried to use my bot to click the "Add to Cart" button without clicking the "Accept Cookies" button, but the website wasn't registering the click (even with an implicit wait) - but it works fine when I code the bot to click the "Accept Cookies" button first and then click the "Add to Cart" button.

Thanks in advance for your time.

Smiley
  • 1
  • 1
  • 1
    Because I tried to use my bot to click the "Add to Cart" button without clicking the "Accept Cookies" button, but the website wasn't registering the click (even with an implicit wait) - show us the code for this part, error stack trace – cruisepandey Nov 08 '21 at 04:45
  • 1
    Update the question with your code trials. – undetected Selenium Nov 08 '21 at 11:03

1 Answers1

0

I am assuming here that due to the "Accept Cookies" pop-up, the "Add to Cart" button is hidden. If you can find the hidden element (Add to Cart btn), than use the following Stackoverflow link to click on a hidden element.

How to click on hidden element in Selenium WebDriver?

Nehra An
  • 51
  • 7