selenium配置项

Posted 诗与浪子

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了selenium配置项相关的知识,希望对你有一定的参考价值。

# 设置浏览设备
mobileEmulation = 'deviceName': 'Pixel 2'
options.add_experimental_option('mobileEmulation', mobileEmulation)
# 设置无头浏览器
options.add_argument('--headless')

# 禁止加载图片
options.add_argument("blink-settings=imagesEnabled=false")

# linux环境运行报错时配置
options.add_argument("--disable-gpu")
options.add_argument("--no-sandbox")
options.add_argument("--hide-scrollbars")
options.add_argument('--disable-dev-shm-usage')

以上是关于selenium配置项的主要内容,如果未能解决你的问题,请参考以下文章

Selenium + Chrome带配置项启动

selenium配置项

Selenium Xpath元素无法定位 NoSuchElementException: Message: no such element: Unable to locate element(代码片段

python selenium片段+网络驱动程序

从其他片段添加新的 RecyclerView 项

CTS测试CtsWindowManagerDeviceTestCases模块的testShowWhenLockedImeActivityAndShowSoftInput测试fail项解决方法(代码片段