I wanted to showcase selenium and instead of starting a complete Java / C# suite I wanted to quickly use Python since it can be done with a single script.
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
print("sample test case started")
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("MyUrl")
element = driver.find_element(By.ID, "Username")
element.send_keys("MyUsername")
driver.close()
print("sample test case successfully completed")
I am getting this error message:
AttributeError: 'dict' object has no attribute 'send_keys'
I would seam that find_element method is returning some kind of dict (Dictonary??) object instead of a selenium web element. How can I fix this??