0

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?

Mayank
  • 1,595
  • 1
  • 11
  • 26

1 Answers1

1

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()
kamestart
  • 51
  • 1
  • 9
  • If it is not clickable, how can I click it? Is there like an activity tab, where I can see which element I clicked or something along those lines ? – Mayank Jul 15 '21 at 05:14
  • This Must Most Likely then mean that the element in not findable, please check by adding this piece of code ``` if btn.isDisplayed(): print('hello') ``` So If Hello Is Printed in the console then the element is finadable. or else i dont know what the problem is. – kamestart Jul 15 '21 at 05:20
  • Just checked, `btn.is_displayed()` returns `False` so hello does not get printed to the console – Mayank Jul 15 '21 at 05:32
  • Hi, sorry for replying so late. please recheck the xpath and cross check it with finding the xpath with the help of the answer at https://stackoverflow.com/a/13884744/14747127 – kamestart Jul 15 '21 at 06:17
  • Wow, turns out I was using the wrong xpath, So I used the correct Xpath and now I get : `NoSuchElementException: Message: no such element: Unable to locate element` – Mayank Jul 15 '21 at 06:27
  • Oh Sorry. i did not see. this means that it is acttualy no element. Im Sorry please refrence it with class, id, xpath. can u please send link / code of the html website? – kamestart Jul 15 '21 at 06:35
  • yeah sure, https://recordings.aakashdigital.com/attend/4m3e2r1i@t!MTA2NzE1M180MDY3MTIwMz9uYW1lPXNoaXZlbiBndXB0YQ – Mayank Jul 15 '21 at 06:36
  • Im confused. Does It Work Now? – kamestart Jul 15 '21 at 06:39
  • I use this xpath: `/html/body/div[7]/i[1]` and still get error, it has no id and I tries it with class and I get the same error – Mayank Jul 15 '21 at 06:41
  • When I go and copy the xpath it tells me it is /html/body/div[8]/i[1]. Pls Try – kamestart Jul 15 '21 at 06:41
  • @Mayank please respond and try – kamestart Jul 15 '21 at 06:46
  • Yeah sorry, here: https://imgur.com/g7zXqw4 ; I still get `/html/body/div[7]/i[1]` – Mayank Jul 15 '21 at 06:47
  • Im so sorry for making this such a long discusiion. Can You Please share your code in the file any can you check again if the element is not null by reffering to post #2 – kamestart Jul 15 '21 at 06:52
  • Here is the code: https://pastebin.com/kVtwyzPJ . I use it in Google Colab. It doesn't even get to the `is_displayed()`. It raises an error before that only – Mayank Jul 15 '21 at 06:55
  • My purpose is to get `src` attribute of video tag with id `recording-video`. I The element is there, but it doesn't have any `src` attribute; I checked it and it gets it's `src` attribute after the button is clicked. That's why I trying to click the button with selenium. – Mayank Jul 15 '21 at 06:57
  • 1
    for me in google colab the following code is working. I will Update The Answer – kamestart Jul 15 '21 at 07:02
  • OMG! It Works. Thank you so much for bearing with me for such a long time. – Mayank Jul 15 '21 at 07:06