KashiPrg / DeepL_PDF_Translator

MIT License
8 stars 1 forks source link

dont work anymore..... #2

Open sonkite225 opened 2 years ago

sonkite225 commented 2 years ago

i think there was a change on the deepl site itself

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//button[@dl-test='translator-lang-option-de-DE']"}

could it be fixed?

sonkite225 commented 2 years ago

here the full output:

C:\Users\Spawni\anaconda3\python.exe C:/Users/Spawni/Desktop/DeepL_PDF_Translator-main/src/main.py [WDM] - ====== WebDriver manager ======

[WDM] - Could not get version for google-chrome. Is google-chrome installed? [WDM] - Get LATEST chromedriver version for None google-chrome [WDM] - Driver [C:\Users\Spawni.wdm\drivers\chromedriver\win32\103.0.5060.134\chromedriver.exe] found in cache Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\Spawni\anaconda3\lib\threading.py", line 973, in _bootstrap_inner self.run() File "C:\Users\Spawni\anaconda3\lib\threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "C:\Users\Spawni\Desktop\DeepL_PDF_Translator-main\src\pdftranslator.py", line 90, in PDFTranslate TranslateAndWrite(mainwindow, progress_window, filename, tl_units) File "C:\Users\Spawni\Desktop\DeepL_PDF_Translator-main\src\pdftranslator.py", line 466, in TranslateAndWrite translated = deepLManager.translate("\n".join(paragraphs)).splitlines() File "C:\Users\Spawni\Desktop\DeepL_PDF_Translator-main\src\deeplmanager.py", line 112, in translate self.openDeepLPage() File "C:\Users\Spawni\Desktop\DeepL_PDF_Translator-main\src\deeplmanager.py", line 96, in openDeepLPage self.__webDriver.find_element_by_xpath("//button[@dl-test='translator-lang-option-" + Settings().target_language_for_translate + "']").click() File "C:\Users\Spawni\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 521, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "C:\Users\Spawni\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1248, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\Spawni\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 425, in execute self.error_handler.check_response(response) File "C:\Users\Spawni\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//button[@dl-test='translator-lang-option-de-DE']"} (Session info: chrome=103.0.5060.134) Stacktrace: Backtrace: Ordinal0 [0x00B15FD3+2187219] Ordinal0 [0x00AAE6D1+1763025] Ordinal0 [0x009C3E78+802424] Ordinal0 [0x009F1C10+990224] Ordinal0 [0x009F1EAB+990891] Ordinal0 [0x00A1EC92+1174674] Ordinal0 [0x00A0CBD4+1100756] Ordinal0 [0x00A1CFC2+1167298] Ordinal0 [0x00A0C9A6+1100198] Ordinal0 [0x009E6F80+946048] Ordinal0 [0x009E7E76+949878] GetHandleVerifier [0x00DB90C2+2721218] GetHandleVerifier [0x00DAAAF0+2662384] GetHandleVerifier [0x00BA137A+526458] GetHandleVerifier [0x00BA0416+522518] Ordinal0 [0x00AB4EAB+1789611] Ordinal0 [0x00AB97A8+1808296] Ordinal0 [0x00AB9895+1808533] Ordinal0 [0x00AC26C1+1844929] BaseThreadInitThunk [0x76F2FA29+25] RtlGetAppContainerNamedObjectPath [0x77917A9E+286] RtlGetAppContainerNamedObjectPath [0x77917A6E+238]

sonkite225 commented 2 years ago

problem solved

in my case target lang was german. deepl has changed internally "de-DE" to only "de".

in data.py line 68:

Target_Lang.GERMAN.value: "de-DE",

must be changed to

Target_Lang.GERMAN.value: "de",

to work again.

(dont know if there are other languages that need a change)