Home > Mobile >  Selenium ElementClickInterceptedException Error
Selenium ElementClickInterceptedException Error

Time:06-27

I am working on this website Basically I want to capture 2 latest news from News section that is below the table and store that news in some json and collect picture if possible but I am not able to go to the news section as It always raise error saying

selenium.common.exceptions.ElementClickInterceptedException: Message: Element <a id="ctl00_ContentPlaceHolder1_CompanyDetail1_lnkNewsTab" href="#divNews"> is not clickable at point (307,786) because another element <iframe id="webpush-onsite" name="webpush-onsite"> obscures it

here is some part of code I tried tough

driver = webdriver.Firefox(executable_path=GeckoDriverManager().install())
stocks_data = ["AKPL","NICA"]

for stock_data in stocks_data:
     self.driver.get(f'https://merolagani.com/CompanyDetail.aspx?symbol= 
      {stock_data.lower()}')
      self.driver.find_element_by_xpath("//li[@id='navNews']"
                              "//a[@id='ctl00_ContentPlaceHolder1_CompanyDetail1_lnkNewsTab']").click()

CodePudding user response:

If you really need to click it regardless a normal user won't be able because as the error says, there's an IFrame on top of it...

Try the following:

  1. Set the window size to 1920x1080 or so, maybe the elements overlap because the screen on Selenium's session is too small

  • Related