Mayank
Mayank

Reputation: 1993

ElementNotInteractable Selenium Python

So I go to this website, Screen looks something like this: play btn I use Ctrl+Shift+C and select the play button, which is where I would click, the element looks like this:

<i class="material-icons flex" ng-show="!fullScreenOverlay.clicked &amp;&amp; !fullScreenOverlay.buffered &amp;&amp; !fullScreenOverlay.showTags &amp;&amp; recordingActivityLoaded" ng-click="playInit()" flex="" role="button" tabindex="0" aria-hidden="false" style="">play_circle_outline</i>

I copy it's xpath and I do this with webdriver:

btn = wd.find_element_by_xpath('/html/body/div[8]/i[1]')
btn.click()

But I receive this error:

ElementNotInteractableException: Message: element not interactable
  (Session info: headless chrome=91.0.4472.101)

I can click on it, why can't the webdriver?

Upvotes: 0

Views: 51

Answers (1)

kamestart
kamestart

Reputation: 51

In This Case The Element is most likely not findable or clickable. Please Check How You Are Getting the element and if it is clickable in the browser or not. For This Case The COde Should Be

import sys
import time
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
wd = webdriver.Chrome('chromedriver',options=chrome_options)
wd.get("https://recordings.aakashdigital.com/attend/4m3e2r1i@t!MTA2NzE1M180MDY3MTIwMz9uYW1lPXNoaXZlbiBndXB0YQ")
time.sleep(4)
btn = wd.find_element_by_xpath('/html/body/div[8]/i[1]')   
btn.click()
wd.save_screenshot('sc.png')
wd.quit()

Upvotes: 1

Related Questions