2

I am trying to click a button using Selenium and Python. The very root of this problem that I need to understand is that when Selenium launches the Chrome window the button that I want to click does nothing when clicked. Like if I physically click the button with my mouse nothing happens. It seems to be the only element on the page functioning this way. I can click around other elements on the page and those react just fine. It's almost as if the button becomes "dead" when the browser is opened with Selenium. Note that the button works fine if I navigate to the site in a Chrome browser NOT launched by Selenium.

I also followed the answer here in case the site was somehow detecting Selenium and killing the button due to using Selenium: Can a website detect when you are using selenium with chromedriver? I've also tried my code on half a dozen other sites and I can click buttons just fine.

Anyone ever seen this before? If so, any solution or am I dead like that button is?

Nate Ruggieri
  • 21
  • 1
  • 2
  • 1
    can you provide url of the site or the error message you are getting so that someone can help you. Alseo what code you tried. – mkhurmi May 06 '20 at 16:12
  • @mkhurmi Thanks for your reply. There are no errors when running my code. I don't believe the code is an issue b/c as mentioned it works just fine on other sites. Here is a URL from the site: https://www.paniniamerica.net/2019-obsidian-kaapo-kakko-purple-finland-trading-card-1-25.html Try to launch that URL in Selenium Chrome and you will see that the "add to cart" button has no functionality. Go the site without using Selenium and the button is clickable. – Nate Ruggieri May 06 '20 at 16:23
  • Hi. I just tried to execute what you are saying and I saw that adding, for instance, two pieces is possible to be clicked, though clicking on the button is not. At first, there was no error in the console but also the button was not clicked and that was weird. And I checked that the button is not clickable even manually. It's like when the bot is opening the platform the button is not having functionality. Really weird case. – dpapadopoulos May 07 '20 at 07:10
  • @dpapadopoulos Yes! You got it exactly right. Other functionality like increasing the quantity works but the "add to cart" button is just dead. I wonder if this is a Selenium issue, a Chrome issue, the website code, or any combination of the above. I guess I'm dead in the water on this bot unless I can find an option outside of Selenium. – Nate Ruggieri May 07 '20 at 16:07
  • @NateRuggieri for some reason this button is not interactable when the user tries to click it through selenium bot (not even manually). So, it's kind of crazy case. Can you try it with geckodriver? It's the driver for Firefox. Try it instead of Chrome in order to check if it's a Chrome-chrome driver issue or not. – dpapadopoulos May 07 '20 at 16:36
  • @dpapadopoulos Just tried Firefox and it's the exact same thing. Dead button. I'm beginning to think it's a Selenium issue. I've Googled for alternatives but are there any that you recommend as an alternative? I'm on a Mac, if that matters. – Nate Ruggieri May 07 '20 at 18:30
  • I checked and all the buttons are not interactable when automating with selenium bot. That’s kind of weird. – mkhurmi May 07 '20 at 20:32

0 Answers0