1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 13:02:38 +00:00

Fix other index error

This commit is contained in:
Myned 2020-10-23 10:06:43 -04:00
parent f8407577c1
commit a376c28207
No known key found for this signature in database
GPG key ID: D42B2DAADE7D2AB5

View file

@ -48,8 +48,14 @@ class Weeb(cmds.Cog):
url = 'https://www.deskhero.ca/products/gmk-metaverse-2' url = 'https://www.deskhero.ca/products/gmk-metaverse-2'
browser.get(url) browser.get(url)
try:
royal_soldout = browser.find_elements_by_css_selector('#data-product-option-1-1')[0].get_attribute('data-soldout') royal_soldout = browser.find_elements_by_css_selector('#data-product-option-1-1')[0].get_attribute('data-soldout')
except IndexError:
royal_soldout = 'true'
try:
novelties_soldout = browser.find_elements_by_css_selector('#data-product-option-1-3')[0].get_attribute('data-soldout') novelties_soldout = browser.find_elements_by_css_selector('#data-product-option-1-3')[0].get_attribute('data-soldout')
except IndexError:
novelties_soldout = 'true'
if royal_soldout != 'true': if royal_soldout != 'true':
message += f'Royal is in stock at Deskhero!\n<{url}>\n' message += f'Royal is in stock at Deskhero!\n<{url}>\n'