I am training to fill forms automatically in Internet Explorer. I did the following code for Chrome and I succeeded but the same code fails for Internet Explorer. My code is:
from selenium import webdriver
from webdriver_manager.microsoft import IEDriverManager
driver = webdriver.Ie(executable_path="C:/Program Files (x86)/IEDriverServer.exe", capabilities={'ignoreZoomSetting':True})
driver.get("https://rosamorel.com/ebook-copywriting-textos-persuasivos/")
nombre = "example"
email = "[email protected]"
accionar = driver.find_element_by_name("input_1.3")
accionar.send_keys(nombre)
accionar = driver.find_element_by_name("input_2")
accionar.send_keys(email)
accionar = driver.find_element_by_name("input_5.1")
accionar.click()
IE opens, it gets the website I want but it stops there with the next error in the Console:
Traceback (most recent call last):
File "c:\Users\Abel\Documents\Ejercicios_python\web_scrapin_test copy.py", line 11, in <module>
accionar = driver.find_element_by_name("input_1.3")
File "C:\Users\Abel\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 496, in find_element_by_name
return self.find_element(by=By.NAME, value=name)
File "C:\Users\Abel\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element
return self.execute(Command.FIND_ELEMENT, {
File "C:\Users\Abel\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Abel\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to find element with name == input_1.3
I tried .find_element_by_id and I have the same problem. I do not why because this method works perfectly for Chrome ¡. Could anyone help?
You have to add a wait / delay before accessing these elements.
Please try this:
In case
By.NAMEwill not work try By.CSS_SELECTOR as following: