Skip to content

Updated deepl DOM handling#314

Closed
Monsterovich wants to merge 4 commits into
eggplants:masterfrom
Monsterovich:feat-fix
Closed

Updated deepl DOM handling#314
Monsterovich wants to merge 4 commits into
eggplants:masterfrom
Monsterovich:feat-fix

Conversation

@Monsterovich
Copy link
Copy Markdown
Contributor

@Monsterovich Monsterovich commented Mar 4, 2026

Fix: #315

@Monsterovich
Copy link
Copy Markdown
Contributor Author

ping @eggplants

@Monsterovich
Copy link
Copy Markdown
Contributor Author

There is a problem, though: progress-text is not displayed for short inputs. For now, can we use this workaround?

            # Wait for translation to complete (check that progress text is empty)
            if len(script) > 500:
                try:
                    await page.wait_for_function(
                        """
                        () => {
                            const elem = document.querySelector('#progress-text');
                            const text = elem?.textContent ?? '';
                            return text.length == 0;
                        }
                        """,
                        timeout=self.timeout,
                    )
                except PlaywrightError as e:
                    msg = f"Translation incomplete after {self.timeout} ms"
                    raise DeepLCLIPageLoadError(msg) from e
            else:
                await page.wait_for_timeout(timeout=5000)

@Monsterovich
Copy link
Copy Markdown
Contributor Author

Backported the code suggested by @noembryo. Input via DOM manipulation is currently completely broken. Also, you now need to install the browser using the playwright install command (we may be able to improve this in the future).

ping @eggplants

@Monsterovich
Copy link
Copy Markdown
Contributor Author

ci

CI can still be adjusted later.

@Monsterovich Monsterovich mentioned this pull request Apr 20, 2026
@eggplants
Copy link
Copy Markdown
Owner

3b0af80

@eggplants eggplants closed this Apr 25, 2026
@Monsterovich Monsterovich deleted the feat-fix branch April 26, 2026 00:14
@Monsterovich
Copy link
Copy Markdown
Contributor Author

Monsterovich commented Apr 26, 2026

@eggplants I still get error 'list' object has no attribute 'name'.

You should probably remove this line and use playwright install instead.

https://github.com/eggplants/deepl-cli/blob/master/deepl/deepl.py#L246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not working anymore

2 participants