栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

将选项传递给Chrome驱动程序硒

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

将选项传递给Chrome驱动程序硒

在这张Chromedriver票证(关于该

silent
选件)的提示下,我查看了的来源
ChromeDriverService.java
,并找到了对的引用
"webdriver.chrome.logfile"

添加

-Dwebdriver.chrome.logfile="/dev/null"
到我的
java
命令后,日志再次变得可读:无用的ChromeDriver日志消失了,而
System.out.println
调用和异常仍显示在控制台中。

我从

java
以下参数开始(Linux / Mac):

DIR=path/to/dir/containing/selenium/and/stuffcd "$DIR" && java -cp "$DIR:$DIR/output:$DIR/bin/selenium-server-standalone-2.33.0.jar" -Dwebdriver.chrome.driver="$DIR/bin/chromedriver" -Dwebdriver.chrome.args="--disable-logging" **-Dwebdriver.chrome.logfile="/dev/null"** AllTests

如果您使用的是Windows:

set DIR=pathtodircontainingseleniumandstuffcd "%DIR%" && java -cp "%DIR%;%DIR%output;%DIR%binselenium-server-standalone-2.33.0.jar" ^-Dwebdriver.chrome.driver="%DIR%binchromedriver.exe" ^-Dwebdriver.chrome.args="--disable-logging" ^**-Dwebdriver.chrome.logfile=NUL** ^AllTests

我的类路径(

-cp
)组成的说明:我的测试位于“ $ DIR / output”目录中。Selenium jar文件位于“ $ DIR / bin /
selenium-server-standalone-2.33.0.jar”中。“ AllTests”是我所包含的类的名称
public staticvoid main(String[] args)
-这将启动我的测试。

其他参数不言自明,请根据需要进行调整。为了方便起见(用于shell / batch脚本中),我在变量中声明了common目录

DIR



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/508790.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号