jdholtz / auto-southwest-check-in

A Python script that automatically checks in to your Southwest flight 24 hours beforehand.
GNU General Public License v3.0
416 stars 80 forks source link

Develop branch: No element present exception during login #279

Open natecodes opened 4 days ago

natecodes commented 4 days ago

Version

7.5

Browser Version

126.0.6478.127

Description

Refer to logs

To Reproduce

Run script as normal

Expected Behavior

No response

Relevant logs and program output

(southwest-venv) ➜  auto-southwest-check-in git:(develop) ✗ python3 southwest.py --verbose
2024-07-02 19:58:09 DEBUG MainProcess[log:24]: Initialized the application
2024-07-02 19:58:09 DEBUG MainProcess[main:113]: Auto-Southwest Check-In v7.5
2024-07-02 19:58:09 DEBUG MainProcess[main:71]: Called with 0 arguments
2024-07-02 19:58:09 DEBUG MainProcess[config:132]: Initializing configuration file
2024-07-02 19:58:09 DEBUG MainProcess[config:161]: Reading the configuration file
2024-07-02 19:58:09 DEBUG MainProcess[config:174]: Reading configuration from environment variables
2024-07-02 19:58:09 DEBUG MainProcess[config:60]: Setting check fares to True
2024-07-02 19:58:09 DEBUG MainProcess[config:75]: Setting retrieval interval to 24 hours
2024-07-02 19:58:09 DEBUG MainProcess[config:109]: Setting notification level to <NotificationLevel.INFO: 1>
2024-07-02 19:58:09 DEBUG MainProcess[config:122]: Using 0 notification services
2024-07-02 19:58:09 DEBUG MainProcess[config:144]: Creating configurations for 1 accounts
2024-07-02 19:58:09 DEBUG MainProcess[config:151]: Creating configurations for 0 reservations
2024-07-02 19:58:09 INFO MainProcess[main:97]: Monitoring 1 account and 0 reservations

2024-07-02 19:58:09 DEBUG Process-1[reservation_monitor:168]: Acquiring lock...
2024-07-02 19:58:09 DEBUG Process-1[reservation_monitor:170]: Lock acquired
2024-07-02 19:58:09 DEBUG Process-1[reservation_monitor:192]: Retrieving reservations for account
2024-07-02 19:58:09 DEBUG Process-1[webdriver:126]: Starting webdriver for current session
2024-07-02 19:58:10 DEBUG Process-1[webdriver:143]: Using browser version: 126.0.6478.127
2024-07-02 19:58:10 DEBUG Process-1[webdriver:147]: Loading Southwest home page (this may take a moment)
Process Process-1:
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/opt/homebrew/Cellar/python@3.9/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/nathan/Desktop/auto-southwest-check-in/lib/reservation_monitor.py", line 44, in monitor
    self._monitor()
  File "/Users/nathan/Desktop/auto-southwest-check-in/lib/reservation_monitor.py", line 171, in _monitor
    reservations, skip_scheduling = self._get_reservations()
  File "/Users/nathan/Desktop/auto-southwest-check-in/lib/reservation_monitor.py", line 196, in _get_reservations
    reservations = webdriver.get_reservations(self)
  File "/Users/nathan/Desktop/auto-southwest-check-in/lib/webdriver.py", line 97, in get_reservations
    driver = self._get_driver()
  File "/Users/nathan/Desktop/auto-southwest-check-in/lib/webdriver.py", line 149, in _get_driver
    driver.js_click("(//div[@data-qa='placement-link'])[2]")
  File "/Users/nathan/Desktop/auto-southwest-check-in/southwest-venv/lib/python3.9/site-packages/seleniumbase/core/sb_driver.py", line 141, in js_click
    return page_actions.js_click(self.driver, *args, **kwargs)
  File "/Users/nathan/Desktop/auto-southwest-check-in/southwest-venv/lib/python3.9/site-packages/seleniumbase/fixtures/page_actions.py", line 1545, in js_click
    element = wait_for_element_present(
  File "/Users/nathan/Desktop/auto-southwest-check-in/southwest-venv/lib/python3.9/site-packages/seleniumbase/fixtures/page_actions.py", line 427, in wait_for_element_present
    timeout_exception(NoSuchElementException, message)
  File "/Users/nathan/Desktop/auto-southwest-check-in/southwest-venv/lib/python3.9/site-packages/seleniumbase/fixtures/page_actions.py", line 252, in timeout_exception
    raise exc(msg)
seleniumbase.common.exceptions.NoSuchElementException: Message:
 Element {(//div[@data-qa='placement-link'])[2]} was not present after 7 seconds!

Additional context

No response

jdholtz commented 4 days ago

Could you run the script with the --debug-screenshots flag and send the image called after_page_load.png in the logs directory? I just added this screenshot so you'll need to get the latest changes (run git pull).

dmytrokoren commented 3 days ago

I just checked, the locator is valid. It's just that SW page took more than 7 seconds to load. We need to increase the wait time to 14 seconds - IMO

jdholtz commented 3 days ago

I just checked, the locator is valid. It's just that SW page took more than 7 seconds to load. We need to increase the wait time to 14 seconds - IMO

Good point. @natecodes could you make the following edit in lib/webdriver.py on line 150? If not, I can push a commit for you to try as well.

-        driver.js_click("(//div[@data-qa='placement-link'])[2]")
+        driver.js_click("(//div[@data-qa='placement-link'])[2]", timeout=15)

Also, a picture of after_page_load.png would be very helpful as well.