Giter Site home page Giter Site logo

vfs-bot's Introduction

vfs-bot

Automate constantly checking for an appointment on VFS Global UKVI

Hi! This is pretty hacky and not at all robust but this is the script I wrote so that my computer was able to text me when appointments became available on the VFS website. Before using it, you'll need to setup the following:

The script you need to run is vfsbot.py. The rest should be explained in the comments!!

The script may be buggy with regards to timeouts and such - let me know if it isn't working and i can try to figure it out!

Good luck!

vfs-bot's People

Contributors

sdudas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vfs-bot's Issues

Help

Good afternoon. The site must have been changed and I can't set up the bot. I am disabled, I have a laptop all day, the main thing for me is to catch a free date, then I will fill everything myself. Please help me start the bot.

There is no captcha
https://visa.vfsglobal.com/blr/ru/pol/login

Bot

Hi, I'm looking for a person who could make a similar bot for another version of the site (for a Polish visa). If you are interested, then I will ask for contact.
[email protected]

need script for other vfs yrl

hello i really appreciate yourk work i wonder if you can help me to make some change for vfs url so it match my country

help

hi need your help

get error message when try to login

2

1
get error message when try to login
https://visa.vfsglobal.com/gbr/en/mlt/login
after add email and password
going to solve the g-captcha
after solve and be true
click on sign in button get this error
"Mandatory field cannot be left empty"
how to fix that
https://www.mediafire.com/file/42uup2lpml1j9v2/Before__Connexion_VFS_Global.html/file
https://www.mediafire.com/file/j33azoraavxxwrw/After_Connexion_VFS_Global.html/file

Function to handle Google Captcha

def Captcha(sb, excel_file_path):
# Check for Google Captcha element
sb.driver.switch_to.default_content()
if sb.is_element_present('//*[@id="g-recaptcha-response"]'):
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.LIGHTWHITE_EX + f"{current_time} - Google Captcha element found")
wait_recaptcha_to_be_solved(sb, excel_file_path)
else:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.YELLOW + f"{current_time} - Google Captcha element not found. Continuing...")
sb.driver.switch_to.default_content()
# Add any further actions or conditions here if needed
def wait_recaptcha_to_be_solved(sb, excel_file_path):
try:
sb.is_element_present('iframe[title="reCAPTCHA"]')
except:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.BLACK + f"{current_time} - ERROR: WE CANNOT SWITCH TO RECAPTCHA IFRAME")
else:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.GREEN + f"{current_time} - NOTE: PRESENCE OF RECAPTCHA")
sb.driver.uc_switch_to_frame("iframe")
print(colorama.Fore.YELLOW + f"{current_time} - WAITING FOR RECAPTCHA TO BE SOLVED...")
for i in range(100):
try:
recaptcha = sb.is_element_present('#recaptcha-anchor[aria-checked="true"]')
except:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.BLUE + f"{current_time} - WARNING: WAITING FOR RECAPTCHA TO BE SOLVED {100-i}...")
sleep(5)
else:
if recaptcha: # Checking if recaptcha is True
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.MAGENTA + f"{current_time} - NOTE: RECAPTCHA HAS BEEN SOLVED")
sb.driver.switch_to.default_content()
return True
else:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.CYAN + f"{current_time} - WARNING: WAITING FOR RECAPTCHA TO BE SOLVED {100-i}...")
sleep(5)
sb.driver.switch_to.default_content()
return False

Cookies Button

def remove_destraction(sb, excel_file_path):
destractions = 0
if destractions != 0:
return
try:
sb.click('//[@id="onetrust-close-btn-container"]/button')
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.BLUE + f"{current_time} - Cookies Click Button")
except:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.BLUE + f"{current_time} - NOTE: NO DESTRACTION THERE")
else:
sb.click('//
[@id="onetrust-close-btn-container"]/button')
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.WHITE + f"{current_time} - NOTE: DESTRACTION HAS BEEN REMVOED")
destractions = 1
return True

FILL EMAIL AND PASSWORD LOGIN PAGE

def login(sb, excel_file_path):
check_notification(sb, excel_file_path)
CloudFlare = '/html/body/app-root/div/div/app-login/section/div/div/mat-card/form/app-cloudflare-captcha-container/div'
if sb.is_element_present(CloudFlare):
sb.highlight(CloudFlare)
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.WHITE + f"{current_time} - CloudFlare Captcha Found")
else:
current_time = datetime.now().strftime("%I:%M:%S %p")
print(colorama.Fore.YELLOW + f"{current_time} - CloudFlare Captcha not found.")

check_notification(sb, excel_file_path)

# Search For Email Place and import 
sb.press_keys("#mat-input-0", str(email))
print(colorama.Fore.RED + f"{current_time} - Email Added")
sleep(1)

# Find the password input field and enter the password
sb.press_keys("#mat-input-1", str(password))
print(colorama.Fore.WHITE + f"{current_time} - Password Added")
sleep(1)
sb.driver.uc_switch_to_frame("iframe") 
if sb.is_element_present("#challenge-stage"):
    sleep(1)
    sb.driver.switch_to.default_content()
    submit_button_CloudFlare(sb, excel_file_path)
else:
    sb.driver.switch_to.default_content()
    sleep(1)
    if sb.is_element_present('iframe[title="reCAPTCHA"]'):
        sleep(1)
        sb.driver.switch_to.default_content()
        submit_button_Gcaptcha(sb, excel_file_path)

def submit_button_CloudFlare(sb, excel_file_path):
try:
sb.click('body > app-root > div > div > app-login > section > div > div > mat-card > form > button')
current_time = datetime.now().strftime("%I:%M:%S %p") # Update current_time
print(colorama.Fore.MAGENTA + f"{current_time} - Sign In (Button) click")
check_notification(sb, excel_file_path)
except:
print(colorama.Fore.MAGENTA + f"{current_time} - ERROR: WE CANNOT FIND THE SUBMIT BUTTON ")
# Check for the error message
if sb.is_text_visible("body > app-root > div > div > app-login > section > div > div > mat-card > form > div.errorMessage.ng-star-inserted > div"):
current_time = datetime.now().strftime("%I:%M:%S %p") # Update current_time
print(colorama.Fore.WHITE + f"{current_time} - 'Mandatory field cannot be left blank' error detected. Restarting the process.")
sb.driver.quit() # Close the browser
main_process()
else:
pass
click_new_booking(sb, excel_file_path)
sleep(2)
return True
def submit_button_Gcaptcha(sb, excel_file_path):
sleep(1)
try:
submit_button = sb.driver.uc_click('.mat-focus-indicator.btn.mat-btn-lg.btn-block.btn-brand-orange.mat-stroked-button.mat-button-base.ng-star-inserted'.replace(" ","."))
print("Notice: SUBMIT BUTTON Clicked")
except Exception as e:
print(f"ERROR: {e}")
return False

if submit_button is not None:
    if len(submit_button) > 0:  # Check if the list is not empty
        try:
            submit_button[0].click()
        except Exception as e:
            print(f"ERROR: {e}")
            return False
    else:
        print("ERROR: SUBMIT BUTTON LIST IS EMPTY")
        return False
else:
    print("ERROR: SUBMIT BUTTON NOT FOUND")
    return False

# Check for the error message
if sb.is_text_visible("Mandatory field cannot be left empty"):
    print("Mandatory field cannot be left empty")
    return False

return True


try:
    sb.click('.mat-focus-indicator.btn.mat-btn-lg.btn-block.btn-brand-orange.mat-stroked-button.mat-button-base.ng-star-inserted'.replace(" ","."))
    current_time = datetime.now().strftime("%I:%M:%S %p")  # Update current_time
    print(colorama.Fore.MAGENTA + f"{current_time} - Sign In (Button) click")
    check_notification(sb, excel_file_path)
except:
    print(colorama.Fore.MAGENTA + f"{current_time} -  ERROR: WE CANNOT FIND THE SUBMIT BUTTON ")
# Check for the error message
if sb.is_text_visible("body > app-root > div > div > app-login > section > div > div > mat-card > form > div.errorMessage.ng-star-inserted > div"):
    current_time = datetime.now().strftime("%I:%M:%S %p")  # Update current_time
    print(colorama.Fore.WHITE + f"{current_time} - 'Mandatory field cannot be left blank' error detected. Restarting the process.")
    sb.driver.quit()  # Close the browser
    main_process()
else:
    pass
click_new_booking(sb, excel_file_path)
sleep(2)
return True

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.