-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlightCheckIn.py
More file actions
54 lines (41 loc) · 1.89 KB
/
Copy pathFlightCheckIn.py
File metadata and controls
54 lines (41 loc) · 1.89 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from selenium import webdriver
import time
import random
class SouthwestCheckIn:
def __init__(self, confirmation_num, first_name, last_name, number):
self.confirmation_num = confirmation_num
self.first_name = first_name
self.last_name = last_name
self.number = number
self.driver = webdriver.Chrome()
self.check_in_link = 'https://www.southwest.com/air/check-in/index.html'
def check_in(self):
self.driver.get(self.check_in_link)
conf_input = self.driver.find_element_by_id('confirmationNumber')
first_name_input = self.driver.find_element_by_id('passengerFirstName')
last_name_input = self.driver.find_element_by_id('passengerLastName')
conf_input.send_keys(self.confirmation_num)
first_name_input.send_keys(self.first_name)
last_name_input.send_keys(self.last_name)
check_in_btn = self.driver.find_element_by_id('form-mixin--submit-button')
check_in_btn.click()
time.sleep(random.randint(2, 5) / 3)
confirm_btn = self.driver.find_element_by_class_name('air-check-in-review-results--check-in-button')
confirm_btn.click()
def send_pass(self):
text_btn = self.driver.find_element_by_class_name('boarding-pass-options--button-text')
text_btn.click()
number_input = self.driver.find_element_by_id('textBoardingPass')
number_confirmation = self.driver.find_element_by_id('textBoardingPassConfirmation')
number_input.send_keys(self.number)
number_confirmation.send_keys(self.number)
confirm_btn = self.driver.find_element_by_id('form-mixin--submit-button')
confirm_btn.click()
if __name__ == '__main__':
checker = SouthwestCheckIn(
'2OCZ9E', # confirmation number
'j', # first name
't', # last name
'7867970') # phone number
checker.check_in()
checker.send_pass()