-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.py
38 lines (26 loc) · 991 Bytes
/
example.py
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
from explicit import waiter
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
try:
driver.get("https://github.com/this/doesntexist")
username_field = waiter.find_element(driver, "login_field", By.ID)
username_field.click()
username_field.send_keys("my_username")
password_field = waiter.find_element(driver, "password", By.ID)
password_field.click()
password_field.send_keys("my_password")
login_button = waiter.find_element(driver, "input.btn-primary", By.CSS_SELECTOR)
login_button.click()
finally:
driver.quit()
from explicit import waiter
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
try:
driver.get("https://github.com/this/doesntexist")
waiter.find_write(driver, "login_field", "my_username", by=By.ID)
waiter.find_write(driver, "password", "my_password", by=By.ID, send_enter=True)
finally:
driver.quit()