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
| from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.select import Select
from selenium.webdriver.chrome.options import Options
import requests
import PySimpleGUI as sg
def get_page_element(by_used, value_used):
global browser
global sg
try:
browser.find_element(by=by_used, value=value_used)
except NoSuchElementException:
sg.Popup('Le code de la page a changé')
browser.quit()
exit()
the_site = 'https://www.haute-garonne.gouv.fr/booking/create/13131/'
try:
browser = webdriver.Chrome()
except:
sg.Popup('Le programme ne trouve pas chromedriver.exe')
exit()
browser.get(the_site)
browser.implicitly_wait(0.5)
get_page_element('By.XPATH', "//input[@id='condition']").click() |
Partager