Commit cf84b0b2 authored by BooDonky's avatar BooDonky
Browse files

run succes

parent 3c36e498
# file: ~/.gitignore_global
.DS_Store
.idea
\ No newline at end of file
...@@ -3,6 +3,8 @@ from selenium.webdriver.common.by import By ...@@ -3,6 +3,8 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support import expected_conditions as EC
from tools.web_function_tools import get_cookies_values,cookie_adder from tools.web_function_tools import get_cookies_values,cookie_adder
from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import Select
import time import time
...@@ -10,19 +12,12 @@ import pickle ...@@ -10,19 +12,12 @@ import pickle
def cookies_saver(driver): def cookies_saver(driver):
# driver.find_element_by_xpath("/html/body/aside[1]/a").click()
# driver.find_element_by_xpath("//*[@id='block-locale-language']/div/ul/li[1]/a").click()
# driver.find_element_by_xpath("//*[@id='edit-name']").send_keys(email)
# driver.find_element_by_xpath("//*[@id='edit-pass']").send_keys(pw)
# driver.find_element_by_xpath("//*[@id='edit-submit']").click()
# storing the cookies # storing the cookies
pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb")) pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb"))
driver.quit() driver.quit()
def cookies_loader(driver): def cookies_loader(driver):
# loading the stored cookies # loading the stored cookies
cookies = pickle.load(open("cookies.pkl", "rb")) cookies = pickle.load(open("cookies.pkl", "rb"))
for cookie in cookies: for cookie in cookies:
...@@ -58,48 +53,86 @@ def searcher(driver,url_bookingsite): ...@@ -58,48 +53,86 @@ def searcher(driver,url_bookingsite):
def booker(driver,nt): def booker(driver,nt):
driver.find_element_by_xpath("//span[text()='Book now']").click() driver.find_element_by_xpath("//span[text()='Book now']|//span[text()='Réserver']").click()
time.sleep(2) time.sleep(1)
#driver.find_element_by_xpath("//button[@class='ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close']").click() #driver.find_element_by_xpath("//button[@class='ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close']").click()
driver.find_element_by_xpath("//li[starts-with(@data-name,'category 1')]|//li[starts-with(@data-name,'categorie 1')]" ).click() driver.find_element_by_xpath("//li[starts-with(@data-name,'category 1')]|//li[starts-with(@data-name,'categorie 1')]" ).click()
# driver.execute_script("document.body.style.zoom='80%'") # driver.execute_script("document.body.style.zoom='80%'")
time.sleep(1) time.sleep(2)
select = Select(driver.find_element_by_tag_name("select")) select = Select(driver.find_element_by_tag_name("select"))
# select by visible text # select by visible text
select.select_by_index(5) try:
time.sleep(3) select.select_by_visible_text(nt)
#driver.find_element_by_name('op').click() time.sleep(1)
except:
select.select_by_visible_text('4')
time.sleep(1)
driver.find_element_by_xpath("//*[starts-with(@id,'edit-submit-')]").click() driver.find_element_by_xpath("//*[starts-with(@id,'edit-submit-')]").click()
def card_information(driver,cardnumber,cvv,expire_date, holder_name): element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//*[@id='new-checkout-button']")))
element.click()
# driver.find_element_by_xpath("//*[@id = 'new-checkout-button']").click()
time.sleep(2) time.sleep(2)
driver.find_element_by_id("new-checkout-button").click()
def card_information(driver,cardnumber,cvv,expire_date,expire_year,holder_name):
driver.find_element_by_xpath("//*[@id='edit-paybox-card-number']").send_keys(cardnumber)
driver.find_element_by_xpath("//*[@id='edit-paybox-security-code']").send_keys(cvv)
driver.find_element_by_xpath("//*[@id='edit-paybox-holder-name']").send_keys(holder_name)
select2 = Select(driver.find_element_by_xpath("//*[@id='edit-paybox-end-month']"))
select2.select_by_value(expire_date)
select3 = Select(driver.find_element_by_xpath("//*[@id='edit-paybox-end-year']"))
select3.select_by_value(expire_year)
driver.find_element_by_xpath("//*[@id='edit-panes-termsofuse-termsofuse']").click()
#driver.find_element_by_xpath("//*[@id='new-confirm-button']/span/span").click()
#============================================================================
url = "https://www.bataclan.fr/" url = "https://www.bataclan.fr/"
#url_bookingsite = "https://www.bataclan.fr/en/event/cult-of-ya-fest_2022-01-15/" # ===> Main Cult of Ya Link
#url_bookingsite = "https://www.bataclan.fr/en/event/david-carreira-_2022-02-11/" #url_bookingsite = "https://www.bataclan.fr/en/event/david-carreira-_2022-02-11/"
url_bookingsite = "https://www.bataclan.fr/en/event/the-jesus-mary-chain_2021-12-05/" #url_bookingsite = "https://www.bataclan.fr/en/event/the-jesus-mary-chain_2021-12-05/"
url_bookingsite = "https://www.bataclan.fr/evenement/alvaro-soler_2022-03-02/"
number_of_tickets = '5' number_of_tickets = '5'
email = "dominik.nguyen98@gmx.ch" email = "dominik.nguyen98@gmx.ch"
pw = "GoogleCool11" pw = "GoogleCool11"
cardnumber = "5178508831917460"
cvv = "225"
expire_date = '12'
expire_year = '22'
holder_name = "Max Hilfiger"
#==========================================================================
driver = webdriver.Chrome() driver = webdriver.Chrome()
driver.get(url) driver.get(url)
#cookies_saver(driver) #cookies_saver(driver)
#cookies_loader(driver) #cookies_loader(driver)
login(driver) login(driver)
searcher(driver, url_bookingsite) searcher(driver, url_bookingsite)
booker(driver,number_of_tickets) booker(driver,number_of_tickets)
#card_information(driver,None,None,None,None) card_information(driver,cardnumber,cvv,expire_date,expire_year,holder_name)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment