3

I am trying to click on the button provided by xpath given below. It displays this error:

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a href="http://gogoanime.io/category/one-piece#disqus_thread">...</a> is not clickable at point (650, 736). Other element would receive the click: <div style="position:fixed;z-index:9999;background:#ffc119;bottom:0;text-align:center;color:#000;width:100%;padding:10px 0;font-weight:600;">...</div>

in cmd.

import requests
from bs4 import BeautifulSoup
from selenium import webdriver

driver = webdriver.Chrome()
url = "https://www5.gogoanime.tv/category/one-piece"
driver.maximize_window()
driver.get(url)
content = driver.page_source.encode('utf-8').strip()
soup = BeautifulSoup(content,'html.parser')
#btn_comment_div = soup.find('div',{'class':'specialButton'})
#btn_comment = btn_comment_div.find('a')
btn_comment = driver.find_element_by_xpath('/html/body/div[2]/div/div/section/section[1]/div[1]/div[7]/div[1]/div/div/a')
btn_comment.click()
Smart Manoj
  • 5,230
  • 4
  • 34
  • 59
Hardik Mehta
  • 111
  • 7

1 Answers1

1

In such cases where selenium is unable to click the element, performing a javascript click will solve the problem. Replace btn_comment.click() with driver.execute_script('arguments[0].click();',btn_comment)

Prasanth Ganesan
  • 541
  • 4
  • 14