-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (30 loc) · 1.29 KB
/
Copy pathmain.py
File metadata and controls
38 lines (30 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
import time
@pytest.fixture(scope="module")
def driver():
options = Options()
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
yield driver
driver.quit()
def test_poe_login(driver):
try:
driver.get("https://poe.com/login")
use_phone_button = driver.find_element(By.CLASS_NAME, "Button_flat__dcKQ1")
use_phone_button.click()
time.sleep(2)
phone_input = driver.find_element(By.CLASS_NAME, "textInput_input__9YpqY")
phone_input.send_keys("18312210562")
go_button = driver.find_element(By.CLASS_NAME, "Button_primary__6UIn0")
go_button.click()
# Add assertions here to verify the login process
assert "Poe" in driver.title, "Login page title is incorrect"
except Exception as e:
pytest.fail(f"Test failed with exception: {str(e)}")