PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, August 4, 2022

[FIXED] How to avoid ElementClickInterceptedException when working with Selenium?

 August 04, 2022     click, exception, python, selenium     No comments   

Issue

I use selenium with python and want to mark a checkbox by clicking on it. After having identified the <input> tag of the checkbox with selenium, I attempt to click on it with

checkbox.click()

However, it throws the ElementClickInterceptedException.

I identify the checkbox I want to click on through a loop. When I try to click on the checkbox outside of the loop (by manually running the code after it was identified and saved to a variable), I found two things:

  • All things equal, I still get the exception
  • When I click in the browser window once (that was opened with selenium) and then run checkbox.click(), it works as expected

Any ideas why and how I could attempt to slove this issue (i.e. being able to click on the checkbox within the loop)?

Thanks!


Solution

You either deal with the overlapping element or use javascript

driver.execute_script("arguments[0].click();", checkbox)


Answered By - Arundeep Chohan
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing