1

Needing help on this problem. All solutions/suggestions I have researched do not fix it.

Trying to click a button with Selenium. Keep getting these errors. selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: [object HTMLButtonElement] has no size and location and selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

I am not understanding why this element is not interactable.

    play_button = driver.find_element_by_xpath('//*[@id="ppp"]/div/div[2]/div[2]/div[2]/button')
    driver.implicitly_wait(10)
    ActionChains(driver).move_to_element(play_button).click(play_button).perform()

When printing play_button = <selenium.webdriver.remote.webelement.WebElement (session="ca50b37ee2e4b194b2ad5305e254079f", element="78e35dc3-fef8-4082-a6e4-0a92dfbf2ec6")>

I have tried WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="ppp"]/div/div[2]/div[2]/div[2]/button'))) but this times out. Element never becomes clickable.

I have tried using the full xpath.

I have tried disabling extensions/maximize window driver options.

The element is not in a frame or anything. It lies in a div that lies in the body. The element is clickable within Chrome's console.

Any information/suggestions would be helpful. Thanks.

1
  • I have suggested some answer, but it would be better if you could share the page link Commented Aug 26, 2021 at 22:09

2 Answers 2

2

The button you are trying to click is hidden, not clickable even with JavaScript executor.
You can start video on that page clicking on

driver.find_element_by_css_selector('div.player-poster.clickable').click()

or

driver.find_element_by_css_selector('div.play-wrapper').click()

No need to use ActionChains(driver).move_to_element etc.
Just a simple click.
Just don't forget setting

driver.implicitly_wait(10)

Or using an explicitly wait of expected conditions to make page loaded before accessing the element.

Sign up to request clarification or add additional context in comments.

11 Comments

First solution - Gave same error of element not interactable: [object HTMLButtonElement] has no size and location on line .move_to_element
Second solution - did nothing at all..... Would this mean the element isnt clickable to being with? whats confusing is I can get the element within Chrome's console and click it but not when ejecting js? Idk. thanks for the suggestions.
Maybe it is inside an iframe? Can you share a link?
Try clicking by this css_selector div.player-poster.clickable
The button you are trying to click is hidden, not clickable even with JS
|
0

Using full XPath solved this problem for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.