1

I am new to python selenium. I want to click the Iniciar session(Login button)enter image description here on this web site. I have tried using the XPath, CSS selector, CSS Path, and class name.

I use the below code to click the button:

from selenium import webdriver
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument('--incognito')
options.add_argument('--headless')
driver = webdriver.Chrome("C:/Users/pralo/Downloads/DE/chromedriver", chrome_options=options)
driver.get('https://www.panamacompra.gob.pa/Inicio/#/')
sleep(10)
driver.find_element(By.XPATH,'//button[text()=" Iniciar sesión"]').click()

I get the below error for the above code execution:

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable at point (389, 1470)

Can anyone help me understand the reason for this error?

1 Answer 1

3

You can utilize the driver.execute_script() method:

from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Chrome()
driver.get('https://www.panamacompra.gob.pa/Inicio/#/')
sleep(10)
element = driver.find_element(By.CLASS_NAME, 'btn-blue-dark')
driver.execute_script("arguments[0].click();", element)

The driver.execute_script() method allows you to run JavaScript code in your Python program!

Sign up to request clarification or add additional context in comments.

Comments

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.