1

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()

1 Answer 1

1

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 🤷‍♂️

  2. Worst case scenario, inject some Javascript code to do it forcefully:

self.driver.execute_script("document.getElementById('ctl00_ContentPlaceHolder1_CompanyDetail1_lnkNewsTab').click()")
  1. Click on exact coordinate (x,y) if you know it ofcs.
Sign up to request clarification or add additional context in comments.

4 Comments

thanks for answer but can you help me get further from there as I am not able to get those news as I want news in json form
I think it'll be a bit annoying in this format, hhh. Maybe just ask a new answer, because it's already kind of a different topic, with what you get, how you get it and what do you expect. (then maybe just ping me on that question, I'll try to help me best ^_^)
hi @Evgeny I have added new qsn stackoverflow.com/questions/72774792/…

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.