Selenide 7.6.0视频录制功能无法正常使用/实现方式存疑
Selenide视频录制功能在Cucumber项目中实现失败求助
近期升级Selenide版本后,对新增的测试录制功能感兴趣,先后尝试在Selenide-JUnit5-Cucumber和Selenide-TestNG-Cucumber项目中实现,但两次都失败了。已经参照官方文档操作,却始终没搞清楚最简实现方式。
我的CucumberRunner代码
@EnableVideo @ExtendWith(VideoRecorderExtension.class) public class RunCucumberTests { }
StepDefinition代码
@ExtendWith(VideoRecorderExtension.class) @EnableVideo public class StarterStep { @BeforeAll static void setUp() { // 配置录制路径 System.setProperty("selenide.video.directory", "target/videos"); System.setProperty("selenide.video.enabled", "true"); } @Video @Given("Start testing") public void openBrowser(){ open("https://www.saucedemo.com/"); } }
另外我注意到,Selenide的Configuration类里没有任何处理视频录制的配置项,比如视频启用相关的设置:
Selenide Configuration类代码
package com.codeborne.selenide; import org.jspecify.annotations.Nullable; import org.openqa.selenium.MutableCapabilities; public class Configuration { private static final SelenideConfig defaults = new SelenideConfig(); public static String baseUrl; public static long timeout; public static long pollingInterval; /** @deprecated */ @Deprecated public static boolean holdBrowserOpen; public static boolean reopenBrowserOnFail; public static String browser; public static @Nullable String browserVersion; public static @Nullable String remote; public static @Nullable String browserSize; public static @Nullable String browserPosition; public static MutableCapabilities browserCapabilities; public static String pageLoadStrategy; public static long pageLoadTimeout; public static boolean clickViaJs; public static boolean screenshots; public static boolean savePageSource; public static String reportsFolder; public static String downloadsFolder; public static @Nullable String reportsUrl; public static boolean fastSetValue; public static TextCheck textCheck; public static SelectorMode selectorMode; public static AssertionMode assertionMode; public static FileDownloadMode fileDownload; public static boolean proxyEnabled; public static @Nullable String proxyHost; public static int proxyPort; public static boolean webdriverLogsEnabled; public static boolean headless; public static @Nullable String browserBinary; public static long remoteReadTimeout; public static long remoteConnectionTimeout; public Configuration() { } public static SelenideConfig config() { return (new SelenideConfig()).baseUrl(baseUrl).timeout(timeout).pollingInterval(pollingInterval).holdBrowserOpen(holdBrowserOpen).reopenBrowserOnFail(reopenBrowserOnFail).browser(browser).browserVersion(browserVersion).remote(remote).browserSize(browserSize).browserPosition(browserPosition).browserCapabilities(browserCapabilities).pageLoadStrategy(pageLoadStrategy).pageLoadTimeout(pageLoadTimeout).clickViaJs(clickViaJs).screenshots(screenshots).savePageSource(savePageSource).reportsFolder(reportsFolder).downloadsFolder(downloadsFolder).reportsUrl(reportsUrl).fastSetValue(fastSetValue).textCheck(textCheck).selectorMode(selectorMode).assertionMode(assertionMode).fileDownload(fileDownload).proxyEnabled(proxyEnabled).proxyHost(proxyHost).proxyPort(proxyPort).webdriverLogsEnabled(webdriverLogsEnabled).headless(headless).browserBinary(browserBinary).remoteReadTimeout(remoteReadTimeout).remoteConnectionTimeout(remoteConnectionTimeout); } static { baseUrl = defaults.baseUrl(); timeout = defaults.timeout(); pollingInterval = defaults.pollingInterval(); holdBrowserOpen = defaults.holdBrowserOpen(); reopenBrowserOnFail = defaults.reopenBrowserOnFail(); browser = defaults.browser(); browserVersion = defaults.browserVersion(); remote = defaults.remote(); browserSize = defaults.browserSize(); browserPosition = defaults.browserPosition(); browserCapabilities = defaults.browserCapabilities(); pageLoadStrategy = defaults.pageLoadStrategy(); pageLoadTimeout = defaults.pageLoadTimeout(); clickViaJs = defaults.clickViaJs(); screenshots = defaults.screenshots(); savePageSource = defaults.savePageSource(); reportsFolder = defaults.reportsFolder(); downloadsFolder = defaults.downloadsFolder(); reportsUrl = defaults.reportsUrl(); fastSetValue = defaults.fastSetValue(); textCheck = defaults.textCheck(); selectorMode = defaults.selectorMode(); assertionMode = defaults.assertionMode(); fileDownload = defaults.fileDownload(); proxyEnabled = defaults.proxyEnabled(); proxyHost = defaults.proxyHost(); proxyPort = defaults.proxyPort(); webdriverLogsEnabled = defaults.webdriverLogsEnabled(); headless = defaults.headless(); browserBinary = defaults.browserBinary(); remoteReadTimeout = defaults.remoteReadTimeout(); remoteConnectionTimeout = defaults.remoteConnectionTimeout(); } }
内容的提问来源于stack exchange,提问作者Mati.M
相关产品推荐
相关产品推荐

