-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtester_ticketer.py
More file actions
42 lines (35 loc) · 1.45 KB
/
tester_ticketer.py
File metadata and controls
42 lines (35 loc) · 1.45 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
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from threading import Thread
from datetime import datetime
import Queue, sys, os
q = Queue.Queue()
ticket_time = datetime(2016, 3, 28, 2, 0, 0, 0)
def get_tickets():
driver = webdriver.Chrome(os.path.dirname(os.path.realpath(__file__)) + '/chromedriver')
while 1:
now = datetime.now()
if now >= ticket_time:
break
''' opens a new chrome application and clicks on the register then checkout button'''
# MANDATORY: include direct path to chromedriver here
# opens bacchanal eventbrite ticketing page
driver.get("https://www.eventbrite.com/e/bach-testers-tickets-24226391790")
# click register button
register = driver.find_element(By.XPATH, '//*[@id="event-page"]/main/div[1]/div[2]/div/div[1]/div[1]/div/div[2]/div/div/div/form/span/span[2]/a').click()
# click checkout buton
checkout = driver.find_element(By.XPATH, '//*[@id="event-page"]/div[7]/div[2]/div/div/section[3]/div/div/div[3]/input').click()
if __name__ == "__main__":
# attempt to get 5 tickets
for i in range(4):
# new thread for each ticket grabber
thread = Thread(target=get_tickets, args = '')
thread.start()
q.put(thread) # add the thread to the queue
print(ticket_time)
try:
while 1:
x = 1
except KeyboardInterrupt:
sys.exit()