I am just starting to learn Selenium and wanted to implement authentication on the "https://mail.ru/" page. There are two "Login" buttons that, when clicked, open a window with an authentication form. However, Selenium does not see the elements of the page that appeared after clicking the "Login" buttons. I have tried searching by xPath, class_name, etc. How can I solve this problem?
from selenium.webdriver.common.by import By
import time
class TestLogMail:
def test_log(self, browser_web):
browser_web.get('https://mail.ru/')
time.sleep(3)
button_log = browser_web.find_element(By.XPATH, '//*[@id="mailbox"]/div[1]/button').click()
time.sleep(5)
input_log = browser_web.find_element(By.CSS_SELECTOR, 'input[name="username"]')
input_log.send_keys('mail')
time.sleep(5)
button_input_pass = browser_web.find_element(By.XPATH, '//*[@id="root"]/div/div/div/div[2]/div/div/form/div[2]/div[2]/div[3]/div/div/div[1]/button').click()
time.sleep(5)
input_pass = browser_web.find_element(By.XPATH, '/html/body/div[1]/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[2]/div/div/div/div/div/input')
input_pass.clear()
input_pass.send_keys('pass')
time.sleep(5)
button_input_pass = browser_web.find_element(By.XPATH, '//*[@id="root"]/div/div/div/div[2]/div/div/form/div[2]/div/div[3]/div/div/div[1]/div/button').click()
time.sleep(5)
browser_web.save_screenshot('result_log.png')
import pytest
from selenium import webdriver
@pytest.fixture
def browser_web():
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)
yield driver
driver.quit()