Skip to content

Commit

Permalink
fix loading bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Cybergenik committed Mar 26, 2022
1 parent 83be2be commit 6e35c96
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions bot/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ async def __cached_screenshot(self, name:str, action:str) -> BytesIO:
await page.goto(url)
if action == "runes":
await page.set_viewport_size({"width": 734, "height": 607})
await page.locator("//html/body/div[1]/div[5]/div[1]/table[3]").click()
await page.click("//html/body/div[1]/div[5]/div[1]/table[3]")
elif action == "build":
await page.set_viewport_size({"width": 734, "height": 667})
await page.locator("//html/body/div[1]/div[5]/div[1]/table[2]").click()
await page.click("//html/body/div[1]/div[5]/div[1]/table[2]")
elif action == "skills":
await page.set_viewport_size({"width": 734, "height": 340})
await page.locator("//html/body/div[1]/div[5]/div[1]/table[1]").click()
await page.click("//html/body/div[1]/div[5]/div[1]/table[1]")
elif action == "stats":
await page.set_viewport_size({"width": 1200, "height": 265})
await page.locator("//html/body/div[1]/div[1]/div[1]").click()
await page.click("//html/body/div[1]/div[1]/div[1]")
else:
return None
except Exception as e:
Expand All @@ -68,19 +68,21 @@ async def get_screenshot(self, name:str, action:str, prefix: str) -> BytesIO:
await page.goto(url)
if action == "matches":
await page.set_viewport_size({"width": 690, "height": 1250})
await page.locator("/html/body/div[1]/div[5]/div[2]").click()
await page.click("//html/body/div[1]/div[5]/div[2]")
elif action == "soloranked_matches":
await page.locator("/html/body/div[1]/div[5]/div[2]/div[1]/ul/li[2]/button").click()
await page.click("//html/body/div[1]/div[5]/div[2]/div[1]/ul/li[2]/button")
await page.wait_for_selector("//html/body/div[1]/div[5]/div[2]/ul")
await page.set_viewport_size({"width": 690, "height": 1250})
await page.locator("/html/body/div[1]/div[5]/div[2]").click()
await page.click("//html/body/div[1]/div[5]/div[2]")
elif action == "flexranked_matches":
await page.locator("/html/body/div[1]/div[5]/div[2]/div[1]/ul/li[3]/button").click()
await page.click("//html/body/div[1]/div[5]/div[2]/div[1]/ul/li[3]/button")
await page.wait_for_selector("//html/body/div[1]/div[5]/div[2]/ul")
await page.set_viewport_size({"width": 690, "height": 1250})
await page.locator("/html/body/div[1]/div[5]/div[2]").click()
await page.click("//html/body/div[1]/div[5]/div[2]")
elif action == "leaderboard":
#await page.click("body > div.l-wrap.l-wrap--summoner > div.l-menu > ul > li:nth-child(6) > a")
await page.set_viewport_size({"width": 970, "height": 391})
await page.click("/html/body/div[1]/div[5]/div[2]")
await page.click("//html/body/div[1]/div[5]/div[2]")
else:
return None
except Exception as e:
Expand Down

0 comments on commit 6e35c96

Please sign in to comment.