Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Click the Button on this website using Selenium and Python

I want to click on the button "Hinzufügen"/"Add to" in this URL using Selenium and python. I tried it with different methods and it's showing the Exception "selenium.common.exceptions.ElementNotInteractableException:". What do you all suggest to make it work?



PS: I have made sure that the element is visible and is shown in the window.
Code
cookie_accept_modal = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.ID, "ensCloseBanner"))
).click()
add_to_cart_button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "div[data-testid='desktop'] > div > form > fieldset > div > div:nth-child(2) > button"))
).click()
They have a button for the mobile and one for the desktop version, the mobile button appears first in the dom and is not reachable, i think you were clicking that one.
(Apr 23, 2022 06:12 PM)SIM-4773582 Wrote:  
Code
cookie_accept_modal = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.ID, "ensCloseBanner"))
).click()
add_to_cart_button = WebDriverWait(driver, 10).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "div[data-testid='desktop'] > div > form > fieldset > div > div:nth-child(2) > button"))
).click()
They have a button for the mobile and one for the desktop version, the mobile button appears first in the dom and is not reachable, i think you were clicking that one.

Thanks bruhh, my chrome is showing me the mobile version instead of the desktop one. I didn't even notice it, u cool 😎👍

Closing this thread, Have a nice day ☺️.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Luffy-_-Aug 20, 2023 02:06 AM 12 445 Aug 20, 2023 02:06 AM
Last Post: Lucky4L
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 630 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by Don CezarAug 20, 2023 01:37 AM 5 496 Aug 20, 2023 01:37 AM
Last Post: Lucky4L