Skip to content

Commit

Permalink
search for hidden purchase button
Browse files Browse the repository at this point in the history
  • Loading branch information
aysylu committed Apr 29, 2024
1 parent b5b3420 commit 1be4ca6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion goportparking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException

import hassapi as hass
import traceback
Expand Down Expand Up @@ -91,7 +92,13 @@ def book_daily(self, event_name, data, kwargs):
return
self.log(f"buying daily: activating quick-buy (on url {self.driver.current_url})")
self.get_entity(entity).set_state(state='purchasing_daily', attributes={'detail': 'Purchasing daily pass...'})
quick_buy = self.driver.find_element(By.PARTIAL_LINK_TEXT, plate)
try:
quick_buy = self.driver.find_element(By.PARTIAL_LINK_TEXT, plate)
except NoSuchElementException:
drop_down = self.driver.find_element(By.CLASS_NAME, 'caret')
drop_down.click()
time.sleep(JS_WAIT)
quick_buy = self.driver.find_element(By.PARTIAL_LINK_TEXT, plate)
quick_buy.click()
time.sleep(5)
self.log(f"buying daily: confirming quick-buy")
Expand Down

0 comments on commit 1be4ca6

Please sign in to comment.