我正在尝试使用初始设置从 Chrome 中提取控制台日志,该设置需要为 chrome webdriver 设置参数(来自Capturing browser logs with Selenium):
System.setProperty("webdriver.chrome.driver", "c:\\path\\to\\chromedriver.exe");
DesiredCapabilities caps = DesiredCapabilities.chrome();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
如何让 Serenity BDD 使用来自 (net.thucydides.core.annotations.Managed) 的 @Managed 管理我的 WebDriver 时让它工作?
我正在使用(JUnit + Selenium + Serenity BDD),我当前的布局测试例如如下:
@RunWith(SerenityRunner.class)
public class UserLoginSuccessfulIT {
@Managed(driver="chrome")
WebDriver driver;
@Steps
LoginSuccessfulSteps user;
@Test
public void user_logs_in_successfully() throws IOException{
//GIVEN
user.opens_loginpage();
//WHEN
user.userTypesUserPass("user", "pass");
user.logs_in();
//THEN
user.sees_welcomepage();
user.check_for_dead_links_from_file();
}
}