首页 > 解决方案 > qaf chromedriver 路径 application.properties

问题描述

我是 QAF 的新手。在 application.properties 中设置路径的格式是什么?我需要包含双引号吗?单斜线还是双斜线?

#set 1 to suppress success log, when 0 it will also show verification success message
report.log.skip.success=0
webdriver.chrome.driver = ??

标签: selenium-webdriverpathselenium-chromedriverqaf

解决方案


当您在本地运行时,webdriver 需要使用底层驱动程序指定的相应属性提供驱动程序可执行路径。大多数情况下属性是webdriver.<drivername>.driver. 对于 chrome,属性是webdriver.chrome.driver. 它需要设置为系统属性。当您使用 qaf 时,它提供了通过属性文件设置该属性的方法。因此该值将是 chrome 驱动程序可执行文件的路径。例如:

webdriver.chrome.driver=c:/downloads/chromedriver.exe

如果您已将驱动程序可执行文件放在项目目录中的某处,则可以提供相对路径。例如驱动程序可执行文件在 <project_dir>/servers/chromedriver.exe 下,那么您可以设置相对路径如下:

webdriver.chrome.driver=servers/chromedriver.exe

注意:通过属性文件为chrome以外的驱动设置驱动可执行路径,需要添加system前缀。例如:

system.webdriver.gecko.driver=<gecko-driver-executable-path>
system.webdriver.ie.driver=<ie-driver-executable-path>
system.webdriver.edge.driver=<edge-driver-executable-path>

编辑:

QAF3.0.1b已集成 Web 驱动程序管理器,因此3.0.1b后续驱动程序可执行文件将自动处理,您无需为驱动程序可执行文件设置任何属性。


推荐阅读