-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paths_p.py
50 lines (40 loc) · 1.9 KB
/
s_p.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
43
44
45
46
47
48
49
50
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# Assuming Chrome, but you can use any WebDriver
driver = webdriver.Chrome()
try:
driver.get("https://verif.tools/en/singapore_passport")
# Find the element and perform a click
WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@id='app']/div/main/div[2]/div/div/div[3]/div/div/p"))
).click()
# Type into input fields
driver.find_element(By.ID, "LN").send_keys("Doe")
driver.find_element(By.ID, "FN").send_keys("john")
driver.find_element(By.ID, "NUMBER").send_keys("K1234567E")
driver.find_element(By.ID, "SEX").send_keys("M")
# Click on another element by its XPath
WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@id='app']/div/main/div[2]/div/div/div[3]/div/div[2]/p"))
).click()
# Continue typing into other input fields
driver.find_element(By.ID, "DOB").send_keys("16.10.1986")
driver.find_element(By.ID, "DOI").send_keys("15.12.2020")
driver.find_element(By.ID, "DOE").send_keys("15.12.2025")
# Perform another click action
WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@id='app']/div/main/div[2]/div/div/div[3]/div/div[5]/p"))
).click()
# And so on, for the remaining steps
driver.find_element(By.ID, "BACKGROUND").send_keys("Photo")
driver.find_element(By.ID, "BACKGROUND_NUMBER").send_keys("1")
# Finally, perform the click to generate
WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, ".text > span"))
).click()
finally:
print("success")
# Close the browser window and quit the WebDriver instance
#driver.quit()