Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why getting this selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element

I know already upload answer to this same question but I try them they are not working for me because there is also some some update in selenium code too.
Getting this Error selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <div class="up-typeahead-fake" data-test="up-c-typeahead-input-fake">...</div> is not clickable at point (838, 0). Other element would receive the click: <div class="up-modal-header">...</div> , When trying to send my searching keyword in this input with labeled "Skills Search"
in advance searching pop-pup form.

Here is the URL: https://www.upwork.com/nx/jobs/search/modals/advanced-search?sort=recency&pageTitle=Advanced%20Search&_navType=modal&_modalInfo=%5B%7B%22navType%22%3A%22modal%22,%22title%22%3A%22Advanced%20Search%22,%22modalId%22%3A%221670133126002%22,%22channelName%22%3A%22advanced-search-modal%22%7D%5D

Here is my code:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.common.proxy import Proxy, ProxyType
import time
from fake_useragent import UserAgent
import pyttsx3
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

def main():
    options = Options()
    service = Service('F:\\work\\chromedriver_win32\\chromedriver.exe')
    options.add_argument("start-maximized")
    options.add_argument('--disable-blink-features=AutomationControlled') #Adding the argument
    options.add_experimental_option("excludeSwitches",["enable-automation"])#Disable chrome contrlled message (Exclude the collection of enable-automation switches)
    options.add_experimental_option('useAutomationExtension', False) #Turn-off useAutomationExtension
    options.add_experimental_option('useAutomationExtension', False) #Turn-off useAutomationExtension
    prefs = {"credentials_enable_service": False,
     "profile.password_manager_enabled": False}
    options.add_experimental_option("prefs", prefs)
    ua = UserAgent()
    userAgent = ua.random
    options.add_argument(f'user-agent={userAgent}')
    driver = webdriver.Chrome(service=service , options=options)
    url = 'https://www.upwork.com/nx/jobs/search/?sort=recency'
    driver.get(url)
    time.sleep(7)



    advsearch = driver.find_element(By.XPATH,'//button[contains(@title,"Advanced Search")]')
    advsearch.click()
    time.sleep(10) 
    skill = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH,'//div[contains(@class,"up-typeahead")]')))
    skill.click()
    time.sleep(10)
    keys = ["Web Scraping","Selenium WebDriver", "Data Scraping", "selenium", "Web Crawling", "Beautiful Soup", "Scrapy", "Data Extraction", "Automation"]
    for i in range(len(keys)):

        skill.send_keys(Keys[i],Keys.ENTER)
        time.sleep (2)

main()

I try to send keys to the input field but its give me Error .ElementClickInterceptedException , I try old answer from stack previous question answer related to this error but they are not working for me because there is also some some update in selenium code too.

>Solution :

That error indicates that you have to click using JS execution like:

 import time

 skill = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH,'//div[contains(@class,"up-typeahead")]')))
 driver.execute_script("arguments[0].click();" ,skill)
 time.sleep(1)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading