the cursor is in the active window from the very beginning, but the input into the field does not occur. There is no way to use find_element for the input, I try switching fields through the TAB button. the site itself and its form open normally
url I'm working with: https://the-internet.herokuapp.com/basic_auth
full code
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class TestLogin:
driver = ''
def setup_method(self):
self.driver = webdriver.Chrome(executable_path='D:\WORK\PycharmProjects\at\chromedriver.exe')
self.driver.implicitly_wait(2)
self.driver.get('https://the-internet.herokuapp.com/basic_auth')
def test_login(self):
action = ActionChains(self.driver)
# user name
action.send_keys(Keys, "admin")
# move to next field
action.send_keys(Keys.TAB)
# password
action.send_keys("admin")
# try to login
action.send_keys(Keys.ENTER)
action.perform()
# check login
self.driver.find_element(By.XPATH, "//div[contains(text(), 'Congratulations!')]")
def teardown_method(self):
self.driver.quit()