selenium: [🐛 Bug]: Translate Doesn't Work with Chrome

What happened?

Translation Doesn’t Work With Any Language-Pairs in Chrome

Initializing Chrome reference

chrome_path = Service(“C:\Python\Anaconda\chromedriver.exe”) custom_options = webdriver.ChromeOptions()

prefs = { “translate_whitelists”: {“ja”:“en”}, “translate”:{“enabled”:“True”} } custom_options.add_experimental_option(‘prefs’, prefs) driver = webdriver.Chrome(service = chrome_path, options=custom_options) I’ve also tried

custom_options.add_argument(‘–lang=en’) driver = webdriver.Chrome(service = chrome_path, options=custom_options)

Issue was discussed multiple times on stackoverflow, for example: https://stackoverflow.com/questions/70876934/translating-chrome-page-using-selenium-is-not-working

How can we reproduce the issue?

Selenium Python Package Version: 4.3.0
Chrome Version: 104.0.5112.83
Chrome-Driver Version: 104.0.5112.79
Python Version: 3.10.6

Note: The mentioned bug affects multiple versions and not only these.

Relevant log output

.

Operating System

macOS Big Sur

Selenium version

4.3.0

What are the browser(s) and version(s) where you see this issue?

Chrome 104.0.5112.83

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 104.0.5112.79

Are you using Selenium Grid?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I suspect it works for Ruby but not Python, I have the same problem as @Ahmad-Agbaria, driver.refresh() and change to boolean do not work

Changed to boolean still same issue

when calling to /newSession in this case, the following capabilities are provided (post-processed):

{'capabilities': {'firstMatch': [{}], 'alwaysMatch': {'browserName': 'chrome', 'pageLoadStrategy': 'normal', 'goog:chromeOptions': {'prefs': {'translate_whitelists': {'ja': 'en'}, 'translate': {'enabled': 'true'}}, 'extensions': [], 'args': []}}}}

however the remote end response capabilities returns:

'goog:chromeOptions': {'debuggerAddress': 'localhost:49882'}

and the page is not translated automatically, i need to read into prefs/and the goog: vendor key/capability (and the expected formats) in general, will report back shortly