2017-02-21 43 views

回答

0

谷歌瀏覽器具有內置功能,可讓您將整個頁面翻譯爲您的語言。您可以將應用程序中的語言設置爲英語,在Chrome中訪問該網站並自動翻譯回您的語言。然而,這可能會很棘手,可能需要諸如https://chrome.google.com/webstore/detail/google-translate/aapbdbdomjkkjkaonfhkkikfgjllcleb?hl=en谷歌瀏覽器擴展來滿足您的要求。您可以使用autoit自動執行此實用程序。

要添加鉻司機延期,請參閱這些鏈接:

Create .CRX fileAdd extension to Chrome WebDriver

可能的解決方法可能是,如果你可以利用像這些定製CONFIGS。那些Python示例,應該幫助:

火狐:

import os 
from selenium import webdriver 

profile = webdriver.FirefoxProfile() 
profile.set_preference('intl.accept_languages', 'es') 
driver = webdriver.Firefox(profile) 

鉻:

from selenium.webdriver.chrome.options import Options 

chrome_options = Options() 
chrome_options.add_experimental_option("prefs", {'--lang': 'es'}) 
driver = webdriver.Chrome(chrome_options=chrome_options) 
+0

**在[283]:FirefoxProfile輪廓=新FirefoxProfile(); **我得到一個錯誤> >「File」「,第1行 FirefoxProfile profile = new FirefoxProfile(); ^ SyntaxError:invalid syntax'請指定我是否需要在執行這些命令之前執行某些操作,因爲我是初學者 – arjun

+0

@arjun我已經更新了片段,請現在嘗試。 – ekostadinov

+0

我使用Firefox,我試過你的建議,但它沒有奏效。我需要使用selenuim來翻譯日文網站 – arjun