eggplants / deepl-cli

DeepL Translator CLI (without API Key)
https://pypi.org/project/deepl-cli/
MIT License
254 stars 18 forks source link

fix: dom handling #212

Closed Monsterovich closed 4 months ago

Monsterovich commented 7 months ago

@eggplants Hello!

Monsterovich commented 7 months ago

Interesting that the first click work, but only if you add a delay of a second, It's a strange behavior.

I tried closing the second banner too, but its dom tree doesn't show up if headless = True. I added a workaround.

I wish I had a better solution.

Monsterovich commented 7 months ago

@eggplants I rewrote the click method to page.locator(element).dispatch_event("click"). For some reason programmatic clicks work much better, all they need is for the element to exist in the DOM.

BTW, it works much faster. When you have time, merge this PR.