码迷,mamicode.com
首页 > 编程语言 > 详细

Selenium设置浏览器的启动语言

时间:2020-04-21 13:15:48      阅读:395      评论:0      收藏:0      [点我收藏+]

标签:sel   ons   zh-cn   net   profile   argument   options   sele   web   

python3.7

Chrome: 

            # 修改lang=zh-CN即可更改语言, 可在 https://blog.csdn.net/Sam_ONE/article/details/102571595 下寻找对应的

    chrome_options = webdriver.ChromeOptions()
            chrome_options.add_argument(‘lang=zh-CN‘)
            driver = webdriver.Chrome(options=chrome_options)
 
Firefox:
     # FireFox_Configure_path 为火狐浏览器不同语言下的配置文件,firefox_path为火狐浏览器geckodriver.exe的所在目录
     ffprofile = webdriver.FirefoxProfile("%s"%FireFox_Configure_path )
             driver = webdriver.Firefox(executable_path=firefox_path, firefox_profile=ffprofile)

Selenium设置浏览器的启动语言

标签:sel   ons   zh-cn   net   profile   argument   options   sele   web   

原文地址:https://www.cnblogs.com/TestDeveloper/p/12743552.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!