-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShoePalaceScript.py
191 lines (122 loc) · 4.45 KB
/
ShoePalaceScript.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from tkinter import *
from tkinter import messagebox
import time
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
def start():
user_start = str(input('Please enter key words: '))
time.sleep(5)
main_link = driver.get(f"https://www.shoepalace.com/search?q={user_start}")
start()
time.sleep(2)
try:
select = driver.find_element_by_class_name("spf-product-card__inner")
select.click()
print('Product Found')
except:
print('PRODUCT NOT FOUND')
#Billing Info
email = 'test123@gmail.com'
first_name = 'John'
last_name = 'Smith'
address = '7474 Lake Road'
city = 'new york city'
country = 'United States'
state = 'NY'
phone = '111-111-1111'
zip_code = '14304'
time.sleep(2)
#Payment Info
credit = '5555555555554444'
credit1 = '3333'
credit2 = '3333'
credit3 = '3333'
name_card = 'John Smith'
exp_date = '03'
exp_date2 = '2'
ssn = '123'
def add_to_cart(cart):
cart = driver.find_element_by_class_name("productForm-buttons")
cart.click()
add_to_cart('cart')
print('Adding To cart....')
#print(driver.page_source)
time.sleep(2)
def checkout(out):
driver.get("https://www.shoepalace.com/checkout")
checkout('out')
print('Hitting checkout.....')
#time.sleep(20) Activate if captcha to give yourself enough time to solve captcha
print('Filling billing info')
#Email
email_grab = driver.find_element_by_name("checkout[email]")
email_grab.send_keys(email)
#First Name
first_name_grab = driver.find_element_by_name("checkout[shipping_address][first_name]")
first_name_grab.send_keys(first_name)
#Last Name
last_name_grab = driver.find_element_by_name("checkout[shipping_address][last_name]")
last_name_grab.send_keys(last_name)
#Address
address_grab = driver.find_element_by_name("checkout[shipping_address][address1]")
address_grab.send_keys(address)
#City
city_grab = driver.find_element_by_name("checkout[shipping_address][city]")
city_grab.send_keys(city)
#Country
country_grab = driver.find_element_by_name("checkout[shipping_address][country]")
country_grab.send_keys(country)
#State
state_grab = driver.find_element_by_name("checkout[shipping_address][province]")
state_grab.send_keys(state)
#ZIP CODE
zip_grab = driver.find_element_by_name("checkout[shipping_address][zip]")
zip_grab.send_keys(zip_code)
#Phone
phone_grab = driver.find_element_by_name("checkout[shipping_address][phone]")
phone_grab.send_keys(phone)
#terms
terms = driver.find_element_by_name("checkout[attributes][I agree to the Terms and Conditions]")
terms.click()
#Continue
cont = driver.find_element_by_id("continue_button")
cont.click()
print('Hitting continue payment')
#Contine to paymet
cont_payment = driver.find_element_by_id("continue_button")
cont_payment.click()
time.sleep(3)
#Credit Card / Debit Card
cc_grab = driver.find_element_by_xpath('//iframe[@title="Field container for: Card number"]').send_keys(credit)
cc_grab1 = driver.find_element_by_xpath('//iframe[@title="Field container for: Card number"]').send_keys(credit1)
cc_grab2 = driver.find_element_by_xpath('//iframe[@title="Field container for: Card number"]').send_keys(credit2)
cc_grab3 = driver.find_element_by_xpath('//iframe[@title="Field container for: Card number"]').send_keys(credit3)
#Name on card
name_card_grab = driver.find_element_by_xpath('//iframe[@title="Field container for: Name on card"]')
name_card_grab.send_keys(name_card)
#Exp date
exp_date_grab = driver.find_element_by_xpath('//iframe[@title="Field container for: Expiration date (MM / YY)"]')
exp_date_grab.send_keys(exp_date)
exp_date_grab.send_keys(exp_date2)
#Security Code
ssn_grab = driver.find_element_by_xpath('//iframe[@title="Field container for: Security code"]')
ssn_grab.send_keys(ssn)
#Submit Payment
time.sleep(2)
try:
payment = driver.find_element_by_id("continue_button")
payment.click()
except:
print('Payment error')
time.sleep(6)
try:
driver.find_elements_by_class_name("notice__text")
print('Payment Failed, Invalid Payment Information.')
except:
print('Payment Success')