Created
August 25, 2021 08:17
-
-
Save kritiketan/a4474253854ae59e033ff7330979282b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.firefox.options import Options | |
from time import sleep | |
#Browser settings | |
options = Options() | |
options.headless = False | |
browser = webdriver.Firefox(options=options) | |
browser.get('https://portal.cvms.vic.gov.au/') | |
def call_portal(browser): | |
content = browser.find_elements_by_xpath("//div[contains(@id,'Error')]") | |
if len(content) == 0: | |
return False | |
elif "queue" not in content[0].get_attribute('textContent'): | |
return False | |
else: | |
browser.refresh() | |
sleep(3) | |
return True | |
for i in range(1,150): | |
print("Retry #",i); | |
if call_portal(browser) == True: | |
call_portal(browser) | |
else: | |
print('Continue the rest of the booking on the browser') | |
break; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment