ranjan-mohanty / vfs-appointment-bot

VFS Appointment Bot - This script automates checking for appointments at VFS Global offices in a specified country.
MIT License
240 stars 107 forks source link

Some feedback #7

Closed Krock21 closed 2 years ago

Krock21 commented 2 years ago

Hi!

Very well done!

I will describe my story

  1. My use case is small ubuntu vps in cloud, and I had to install geckodriver(and firefox) via sudo apt install firefox-geckodriver (README way didn't work) Then I saw selenium.common.exceptions.WebDriverException: Message: newSession After I had to run pip install -U selenium and install latest geckodriver manually https://github.com/mozilla/geckodriver/releases/tag/v0.31.0 as suggested here https://stackoverflow.com/questions/52997746/selenium-crashing-with-selenium-common-exceptions-webdriverexception-message-n Then I saw 'WebDriver' object has no attribute 'find_element_by_xpath' and had to adjust code accordingly https://stackoverflow.com/questions/72754651/attributeerror-webdriver-object-has-no-attribute-find-element-by-xpath Then I saw Failed to decode response from marionette, so I had to upgrade my vps from 0.5GB RAM to 2 GB as suggested here https://stackoverflow.com/questions/49734915/failed-to-decode-response-from-marionette-message-in-python-firefox-headless-s And then I got selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //section/div/div[2]/button/span and it it purely my mistake as I need to change hardcoded URL for vfs for my countries self._web_driver.get("https://visa.vfsglobal.com/ind/en/deu/login") And then I finally got Appointment slots available: No appointment slots are currently available. Please try another application centre if applicable because code expects different failure message

  2. You have typos in readme Install geekodriver should be Install geckodriver export PATH=$PATH:/path-to-extracted-file/geckodrive should be export PATH=$PATH:/path-to-extracted-file/geckodriver

Krock21 commented 2 years ago

After 60th attempt it started failing :(

[2022-09-03 12:11:30,875] DEBUG [vfs_appointment_bot.py __main__ <module> (50)]: Unable to login. VFS website is not responding
Traceback (most recent call last):
  File "/home/krock21/krock21/vfs-appointment-bot/vfs_appointment_bot/_VfsClient.py", line 62, in _validate_login
    _new_booking_button = self._web_driver.find_element("xpath", "//section/div/div[2]/button/span")
  File "/home/krock21/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 855, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "/home/krock21/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 428, in execute
    self.error_handler.check_response(response)
  File "/home/krock21/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //section/div/div[2]/button/span
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.jsm:12:1
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:192:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:404:5
element.find/</<@chrome://remote/content/marionette/element.js:291:16
Krock21 commented 2 years ago

Changed timeout to 300 sec and after 10 attemts it is working again

ranjan-mohanty commented 2 years ago

Hey @Krock21rus,

Thanks for the feedback. I have fixed the typos in the readme. Sorry, for responding so late. I created this bot specifically for my use case and added here so that somebody with a similar use case can use it. I'm not actively contributing anymore. But I'm glad that you were able to fix the issues you were facing and were able to run it. 👍

All the best!

ranjan-mohanty commented 2 years ago

I have pinned the issue so that anybody else facing this same issue can follow the same steps.

Krock21 commented 2 years ago

Thanks!

It was my intent, to help people configuring it and using it in "production"

diptilenka commented 11 months ago

@ranjan-mohanty Hi Ranjan, the new vfs website has cloudflare in it and it failed to validate as human. How could we pass this?