Skip to content

Commit

Permalink
Revert next renew button iteration change (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsetton authored Dec 23, 2023
1 parent c468df4 commit 177098b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions craigslist-renew.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ def check_expired():
def renew_posts():
# loop thru up to 5 pages
for page in range(1, 6):
# loop thru renew buttons
for button in driver.find_elements(By.XPATH, '//input[@type="submit" and @value="renew"]'):
# look for all listings with a renew button
while True:
try:
# find next renew button element
button = driver.find_element(By.XPATH, '//input[@type="submit" and @value="renew"]')
# fetch posting link
form_action = button.find_element(By.XPATH, '..').get_attribute('action')
post_id = form_action.split('/')[-1]
Expand All @@ -91,7 +93,7 @@ def renew_posts():
driver.refresh()

except NoSuchElementException:
continue
break

# go to next page if link found
try:
Expand Down

0 comments on commit 177098b

Please sign in to comment.