0

Im trying to click the like button with selenium this is the exception error I'm getting:

[-] Passed One Message: Element <span class="glyphsSpriteHeart__filled__16__white u-__7"> is not clickable at point (1039,84) because another element <div class="_2dDPU   CkGkG"> obscures it

I have tried solving it with a loop that clicks all of the aria label like elements with Xpath, see my code:

        while count <= likes:
            try:
                likeopt = bot.find_elements_by_xpath("//*[@aria-label='Like'] ")
                for likeopti in likeopt:
                    likeopti.click()
                    #bot.find_element_by_class_name("fr66n").click()
                    print("[+] Liked !", count)
                    count += 1
                time.sleep(random.randint(8, 15))
                bot.find_element_by_class_name("_65Bje").click()
                time.sleep(random.randint(8, 15))
            except Exception as e:
                try:
                    bot.find_element_by_class_name("_65Bje").click()
                    time.sleep(random.randint(3, 7))
                    print("[-] Passed One", e)
                except Exception as x:
                    bot.find_elements_by_xpath("//*[@aria-label='Close'] ")
                    continue
                    print(x,"[+]click on X, finished all posts")

How do you think can it can be solved?

Thanks

Site Lab
  • 35
  • 5
  • Does this answer your question? [Debugging "Element is not clickable at point" error](https://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error) – Prophet May 12 '21 at 16:04
  • you can also remove the offending piece of the DOM from the DOM once you've located it. – DMart May 12 '21 at 16:46
  • Can you share a link to the site? – vitaliis May 13 '21 at 02:14

1 Answers1

-1

Watch your script running, and pay attention to the point where it fails. You will likely see that there's some sort of drop down menu, pop-up 'dialog', or even an advertisement, that has displayed over your target link. You'll need to close/dismiss this to be able to get at the target link.

Alternatively, you can hack it by instructing the driver to send a click command via Javascript. bot.execute_script("arguments[0].click();", likeopt) I typically save this approach as a last resort since it does not represent how a user would interact with the page.

Breaks Software
  • 1,721
  • 1
  • 10
  • 15