From 014e313780b8bbe61755eba01afbe997ba9cb954 Mon Sep 17 00:00:00 2001 From: EAR Date: Tue, 3 Oct 2023 08:50:52 -0500 Subject: [PATCH] Swap language buttons css class selector for xpath --- setup.py | 2 +- srtranslator/translators/deepl_scrap.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index c83fefd..129c009 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ long_description=Path("README.md").read_text(encoding="utf-8"), long_description_content_type="text/markdown", url="https://github.com/sinedie/SRTranslator", - version="0.2.91", + version="0.2.92", author="EAR", author_email="sinedie@protonmail.com", license="FREE", diff --git a/srtranslator/translators/deepl_scrap.py b/srtranslator/translators/deepl_scrap.py index 8691e6a..1680dd3 100644 --- a/srtranslator/translators/deepl_scrap.py +++ b/srtranslator/translators/deepl_scrap.py @@ -100,16 +100,16 @@ def _closePopUp(self): ).click() def _set_source_language(self, language: str) -> None: - self._set_language(language, "lmt__language_select--source") + self._set_language(language, "//*[@data-testid='translator-source-lang']") self.src_lang = language def _set_destination_language(self, language: str) -> None: - self._set_language(language, "lmt__language_select--target") + self._set_language(language, "//*[@data-testid='translator-target-lang']") self.target_lang = language - def _set_language(self, language: str, dropdown_class: str) -> None: + def _set_language(self, language: str, xpath: str) -> None: # Click the languages dropdown button - Button(self.driver, "CLASS_NAME", dropdown_class).click() + Button(self.driver, "XPATH", xpath).click() # Get the language button to click based on is dl-test property or the text in the button xpath_by_property = (