Haskell Webdriver Selenium Firefox无头模式
我喜欢使用这个奇妙的软件包。但有一点奇怪的是Firefox浏览器类型不支持命令行选项。 有人能帮助我如何使用命令行选项运行firefox headless模式吗? 我猜我可以使用firefox配置文件,但在谷歌搜索了很多之后,我找不到链接到firefox配置文件的headless模式Haskell Webdriver Selenium Firefox无头模式,haskell,Haskell,我喜欢使用这个奇妙的软件包。但有一点奇怪的是Firefox浏览器类型不支持命令行选项。 有人能帮助我如何使用命令行选项运行firefox headless模式吗? 我猜我可以使用firefox配置文件,但在谷歌搜索了很多之后,我找不到链接到firefox配置文件的headless模式 data Browser = Firefox { -- |The firefox profile to use. If Nothing, -- a default
data Browser = Firefox { -- |The firefox profile to use. If Nothing,
-- a default temporary profile is automatically created
-- and used.
ffProfile :: Maybe (PreparedProfile Firefox)
-- |Firefox logging preference
, ffLogPref :: LogLevel
-- |Server-side path to Firefox binary. If Nothing,
-- use a sensible system-based default.
, ffBinary :: Maybe FilePath
-- |Available after Firefox 52, and required only for Firefox
-- geckodriver. Indicates whether untrusted and self-signed TLS
-- certificates are implicitly trusted on navigation for the
-- duration of the session.
, ffAcceptInsecureCerts :: Maybe Bool
}
| Chrome { -- |Version of the Chrome Webdriver server server to use
--
-- for more information on chromedriver see
-- <https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver>
chromeDriverVersion :: Maybe String
-- |Server-side path to Chrome binary. If Nothing,
-- use a sensible system-based default.
, chromeBinary :: Maybe FilePath
-- |A list of command-line options to pass to the
-- Chrome binary.
, chromeOptions :: [String]
-- |A list of extensions to use.
, chromeExtensions :: [ChromeExtension]
-- | Experimental options not yet exposed through a standard API.
, chromeExperimentalOptions :: Object
}
data Browser=Firefox{--|要使用的Firefox配置文件。如果没有,
--将自动创建默认的临时配置文件
--用过。
ffProfile::Maybe(PreparedProfile Firefox)
--| Firefox日志记录首选项
,ffLogPref::LogLevel
--| Firefox二进制文件的服务器端路径。如果没有,
--使用基于系统的合理默认值。
,ffBinary::可能是文件路径
--| Firefox 52之后提供,仅Firefox需要
--geckodriver。指示是否存在不受信任和自签名的TLS
--证书在导航时受隐式信任
--会议的会期。
,ffacceptincecurecerts::可能是Bool
}
|要使用的Chrome Webdriver服务器的Chrome{--|版本
--
--有关chromedriver的更多信息,请参阅
--
chromeDriverVersion::可能是字符串
--| Chrome二进制文件的服务器端路径。如果没有,
--使用基于系统的合理默认值。
,chromebarine::可能是文件路径
--|要传递给用户的命令行选项列表
--铬二进制。
,chromeOptions::[字符串]
--|要使用的扩展列表。
,chromeExtensions::[ChromeExtension]
--|尚未通过标准API公开的实验选项。
,chromeExperimentalOptions::Object
}
目前,Haskell库中没有内置特定的开关,因此您必须使用WDConfig
的wdCapabilities
字段中的additionalCaps
字段,而不是browser
字段,并在moz:firefoxOptions
aeson对象中包含args
数组,如下所示:
firefoxConfig∷ WDConfig
firefoxConfig=defaultConfig{
wdCapabilities=defaultCaps{
附加上限=[
(“moz:firefoxOptions”,对象[
(“args”,数组(fromList[String”--headless“]))
])
]
}
}
如果您希望传递给Firefox的任何其他未在Haskell中记录的内容也将被传递给Firefox
这在中有解释。我不明白:为什么你说firefox不使用命令行选项?在linux
firefox上的这里--help
和manFirefox
列出了几个选项,包括--headless
。