Skip to content

Commit

Permalink
Use page.locator(element).dispatch_event("click") for page clicks (#212
Browse files Browse the repository at this point in the history
…) (#238)

Co-authored-by: Monsterovich <[email protected]>
  • Loading branch information
eggplants and Monsterovich authored Apr 30, 2024
1 parent 20aa6c0 commit b56375e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions deepl/deepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ async def __translate(self, script: str) -> str:
# banner prevents clicking on language buttons, close the banner first
await page.click("button[data-testid=cookie-banner-lax-close-button]")
# select input / output language
await page.click("button[data-testid=translator-source-lang-btn]")
await page.click(f"button[data-testid=translator-lang-option-{self.fr_lang}]")
await page.click("button[data-testid=translator-target-lang-btn]")
await page.click(f"button[data-testid=translator-lang-option-{self.to_lang}]")
await page.locator("button[data-testid=translator-source-lang-btn]").dispatch_event("click")
await page.locator(f"button[data-testid=translator-lang-option-{self.fr_lang}]").dispatch_event("click")
await page.locator("button[data-testid=translator-target-lang-btn]").dispatch_event("click")
await page.locator(f"button[data-testid=translator-lang-option-{self.to_lang}]").dispatch_event("click")
# fill in the form of translating script
await page.fill("div[aria-labelledby=translation-source-heading]", script)

Expand Down

0 comments on commit b56375e

Please sign in to comment.