-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_ncdmv.py
42 lines (35 loc) · 1.52 KB
/
test_ncdmv.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
39
40
41
42
# Generated by Selenium IDE
from selenium import webdriver
class Test27606:
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def test_27606(self):
self.driver.get(
# "https://skiptheline.ncdot.gov/Webapp/Appointment/Index/a7ade79b-996d-4971-8766-97feb75254de"
"https://skiptheline.ncdot.gov/Webapp/Appointment/Index/a7ade79b-996d-4971-8766-97feb75254de"
)
self.driver.set_window_size(1280, 775)
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
wait = WebDriverWait(self.driver, 10) # wait for maximum of 10 seconds
wait.until(EC.element_to_be_clickable((By.ID, "cmdMakeAppt"))).click()
wait.until(
EC.element_to_be_clickable(
(By.CSS_SELECTOR, ".QflowObjectItem:nth-child(2) .form-control-child")
)
).click()
wait.until(EC.element_to_be_clickable((By.ID, "search-input"))).click()
wait.until(EC.element_to_be_clickable((By.ID, "search-input"))).send_keys(
"27606"
)
wait.until(
EC.element_to_be_clickable((By.CSS_SELECTOR, ".input-results"))
).click()
# save html
with open("ncdmv.html", "w") as f:
f.write(self.driver.page_source)
print(f"HTML saved to {f.name}")