1

I'm trying to automate the process of logging into Microsoft Planner using Selenium and Python and I'm getting stuck at the step after providing a password.

In Firefox, the error received is

selenium.common.exceptions.ElementClickInterceptedException: Message: Element is not clickable at point (1089,523) because another element obscures it

I understand that there are multiple posts with this question and I have tried 5 approaches based on them. I see the error in Approach 1 and 3, while all the other approaches don't throw an excpetion, but also do not move the cursor Image of final result - doesn't click on 'Sign in'

enter image description here

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


driver = webdriver.Firefox() 
# driver = webdriver.Chrome() 
driver.maximize_window()

url = 'https://tasks.office.com/company_domain/group_id'
email_id = "email_id_registered_for_microsoft_planner"
password = "password"

driver.get(url)
driver.implicitly_wait(2)
driver.find_element(By.ID, "i0116").send_keys(email_id)
driver.find_element(By.ID, "idSIButton9").click()
driver.implicitly_wait(2)
driver.find_element(By.ID, "i0118").send_keys(password)
driver.implicitly_wait(2)

# Approach 1
# element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "idSIButton9")))
# element.click()

# Approach 2
# element = driver.find_element(By.ID, "idSIButton9")
# driver.execute_script("arguments[0].click();", element)

# Approach 3
# WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "idSIButton9"))).click()

# Approach 4
# actions = ActionChains(driver)
# actions.send_keys(Keys.TAB * 2)
# actions.perform()

# Approach 5
# element = driver.find_element(By.XPATH, '//*[@id="idSIButton9"]')
# ActionChains(driver).move_to_element(element).click().perform()

I tried this with Chrome as well and get the same behavior (approach 1, 3 fail while all others don't report an error but don't do the job) but with a different error:

selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

I am using

  • Firefox version 99.0.1, Chrome version 100.0.4896.127
  • Python 3.8.10
  • Selenium 4.1.3
  • Geckodriver version 0.31.0, Chrome driver version 100.0.4896.127 (ff0d0695743e65305d7194f9bd309e5e1c824aa0-refs/branch-heads/4896_88@{#4})
  • Ubuntu 20.04.3 LTS
electech
  • 31
  • 3
  • Can you please share the full ElementClickInterceptedException exception message. Which element is obscuring your target element? You should see the element which the selenium complains about will receive the click – Shivam Mishra Apr 24 '22 at 12:47
  • Reduce the scope of your question from ElementClickInterceptedException/StaleElementReferenceException and Geckodriver/Chromedriver to a single usecase to recieve a canonical answer. – undetected Selenium Apr 24 '22 at 12:50
  • @ShivamMishra I've update the error message to show that. – electech Apr 24 '22 at 13:16
  • @electech It's not only about the title. One question should be specific to a single error wrt one specific environment. It's almost impossible to address all the relevant scenarios of multiple Erroe/Browser/Browser Driver in a single answer. – undetected Selenium Apr 24 '22 at 13:23
  • for `approach 1, 3` are we saying that we are getting `ElementClickInterceptedException` and other approaches do not really show any error in the console? If so, in what cases are we getting `StaleElementReferenceException` ? – cruisepandey Apr 24 '22 at 13:53
  • @undetectedSelenium, do you suggest splitting this into 2 problems - one for Firefox and one for Chrome? – electech Apr 24 '22 at 15:58
  • @cruisepandey that is correct. Approach 2, 4, 5 show no errors on the console, but the cursor is still at the password prompt. Approach 1 and 3 fail with `ElementClickInterceptedException` in Firefox, and again, cursor is still at the password prompt. In Chrome, I get the `StaleElementReferenceException` for approach 1 and 3 (2, 4, 5 respond similar to what happens in Firefox) and the chrome Window closes out (unlike in Firefox). – electech Apr 24 '22 at 15:58

0 Answers0