forked from juancatorr/visausa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisaVerification.py
103 lines (90 loc) · 4.49 KB
/
visaVerification.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Generated by Selenium IDE
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
class TestVisaVerification():
def setup_method(self, method):
options = Options()
# options.add_argument('--headless')
# options.add_argument('--disable-gpu')
self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), chrome_options=options)
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def test_visaVerification(self):
# try:
# Test name: Visa Verification
# Step # | name | target | value
# 1 | open | /es-ar/niv/users/sign_in |
print('open site 🚀')
self.driver.get("https://ais.usvisa-info.com/es-ar/niv/users/sign_in")
# 2 | setWindowSize | 1512x871 |
# self.driver.set_window_size(1512, 871)
# 3 | type | id=user_email | reemplazar 'email' con el email real
self.driver.find_element(By.ID, "user_email").send_keys("email")
# 4 | type | id=user_password | reemplazar 'password' con el password real
self.driver.find_element(By.ID, "user_password").send_keys("password")
# 5 | click | css=.icheckbox |
print('login 🚀')
self.driver.find_element(By.CSS_SELECTOR, ".icheckbox").click()
# 6 | click | name=commit |
self.driver.find_element(By.NAME, "commit").click()
# # 7 | click | linkText=Continuar |
self.driver.find_element(By.LINK_TEXT, "Continuar").click()
# 8 | open | https://ais.usvisa-info.com/es-ar/niv/schedule/36229112/appointment |
# self.driver.get("https://ais.usvisa-info.com/es-ar/niv/schedule/36229112/appointment")
time.sleep(2)
# 9 | click | id=appointments_asc_appointment_facility_id |
self.driver.find_element(By.LINK_TEXT, "Reprogramar cita").click()
# 10 | click | id=appointments_asc_appointment_date |
time.sleep(2)
reschedulerButton = self.driver.find_elements(By.LINK_TEXT, "Reprogramar cita")
# print('🚀',reschedulerButton)
reschedulerButton[1].click()
# self.driver.find_element(By.CSS_SELECTOR, "a.accordion-title").click()
print('Select new date to Consulate appoinment 🚀')
element = None
while element == None:
element = 'found'
try:
# 11 | click | css=.ui-icon-circle-triangle-e |
self.driver.find_element(By.ID, "appointments_consulate_appointment_date").click()
self.driver.find_element(By.CSS_SELECTOR, ".ui-icon-circle-triangle-e").click()
# 12 | click | xpath=//td[@data-handler='selectDay']/a |
self.driver.find_element(By.XPATH, "//td[@data-handler=\'selectDay\']/a").click()
except:
element = None
# 13 | click | id=appointments_asc_appointment_time |
print('Select new time to Consulate appoinment 🚀')
# self.driver.find_element(By.ID, "appointments_asc_appointment_time").click()
self.driver.find_element(By.ID, "appointments_consulate_appointment_time_input").click()
# 14 | select | id=appointments_asc_appointment_time | label=09:45
# dropdown = Select(self.driver.find_element(By.ID, "appointments_asc_appointment_time"))
dropdown = Select(self.driver.find_element(By.ID, "appointments_consulate_appointment_time"))
# dropdown.find_element(By.XPATH, "//option[. = '09:45']").click()
selected_time = None
times = ['07:00', '07:15', '07:30', '07:45', '08:00', '08:15', '08:30', '08:45', '09:00','09:15','09:30','09:45','10:00','10:15','10:30','11:00','11:15','11:30','11:45','12:00']
i = 0
print('🚀',dropdown)
print(dropdown.select_by_value('08:30'))
print(dropdown.select_by_value(times[1]))
print(dropdown.select_by_value(times[2]))
print(dropdown.select_by_value(times[3]))
while selected_time == None:
selected_time = 'true'
try:
dropdown.select_by_value(times[i]).click()
except:
selected_time = None
i+=1
# except:
# print('Hello')
# self.teardown_method
obj = TestVisaVerification()
obj.setup_method('get')
obj.test_visaVerification()
# obj.teardown_method('get')