Skip to content

Commit

Permalink
Fix senseless confirm box class CSS selector. Likely to change again …
Browse files Browse the repository at this point in the history
…in the future...
  • Loading branch information
KarmaKamikaze committed May 20, 2023
1 parent 94d78f9 commit 296e3be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ dmypy.json
# Data
[Dd]ata/
settings.json

# Images
.png
14 changes: 12 additions & 2 deletions moxfield_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,18 @@ def __login(self, username: str, password: str) -> None:
)
username_box = self.__driver.find_element_by_css_selector("#username")
username_box.send_keys(username)
WebDriverWait(driver=self.__driver, timeout=5).until(
EC.presence_of_element_located((By.CSS_SELECTOR, "#password"))
)
password_box = self.__driver.find_element_by_css_selector("#password")
password_box.send_keys(password)
WebDriverWait(driver=self.__driver, timeout=5).until(
EC.presence_of_element_located((By.CSS_SELECTOR,
"#maincontent > div > div.col-lg-8 > div > "
"div.card.border-0.col-sm-9.col-lg-7 > div > form >"
"div:nth-child(3) > button "
))
)
sign_in_box = self.__driver.find_element_by_css_selector(
"#maincontent > div > div.col-lg-8 > div > div.card.border-0.col-sm-9.col-lg-7 > div > form > "
"div:nth-child(3) > button "
Expand Down Expand Up @@ -143,13 +153,13 @@ def __set_price_to_lowest(self) -> None:
(
By.CSS_SELECTOR,
"body > div.modal.zoom.show.d-block.text-start > div > div > div.modal-footer > "
"button.btn.btn-custom.btn-primary",
"button.btn.xfXbvFpydldcPS0H45tv.btn-primary > span.YdEWqn292WqT4MUY5cvf",
)
)
)
confirm_box = self.__driver.find_element_by_css_selector(
"body > div.modal.zoom.show.d-block.text-start > div > div > div.modal-footer > "
"button.btn.btn-custom.btn-primary "
"button.btn.xfXbvFpydldcPS0H45tv.btn-primary > span.YdEWqn292WqT4MUY5cvf"
)
confirm_box.click()
time.sleep(2) # wait for prompt to disappear
Expand Down

0 comments on commit 296e3be

Please sign in to comment.