使用Browserstack SDK,我想在浏览器上运行Java Selenium测试:Chrome,Edge和Safari在Browserstack Cloud中;但是,我需要设置浏览器特定功能:
,例如,
染色的Args:-
-可启用延伸性活性-log测试
-可启用不安全的extension-debugging
-信任下载源
-启动最大化-ignore-certificate-orrors
-可见的popup-blocking
-Incognito
-可降低载荷 - 改进
-窗口大小=1920,900
EdgeOptionsargs:--启动最大化
--headless =new
这是Browserstack SDK YAML配置可用功能文件: Browserstack SDK功能和配置YAML GIST:
https://gist.github.com/prateeksabs/0532C79795463D5806234A320880D911https://www.browserstack.com/docs/automate/selenium/sdk-faqs/generic/capability-priority“ browserstack.yml文件和测试脚本定义功能,哪些功能优先? 如果您在browserstack.yml文件和测试脚本中都声明了功能,则SDK将合并这些功能。但是,如果您在这两个位置都有类似的功能,则browserstack.yml文件中的功能为优先级。”
这是在Browserstack SDK示例项目中配置remotewebdriver的方式:
https://www.browserstack.com/docs/automate/selenium/getting-started/java/selenide @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
MutableCapabilities capabilities = new MutableCapabilities();
HashMap<String, String> bstackOptions = new HashMap<>();
bstackOptions.put("source", "selenide:sample-master:v1.2");
capabilities.setCapability("bstack:options", bstackOptions);
driver = new RemoteWebDriver(new URL(String.format("https://%s:%s@hub-
cloud.browserstack.com/wd/hub", userName, accessKey)), capabilities);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
WebDriverRunner.setWebDriver(driver);
}
这是Browserstack示例项目yaml文件:
我知道我可以为Chrome选项做以下操作:
@BeforeMethod(alwaysRun = true)
public void setUp() throws Exception {
MutableCapabilities capabilities = new MutableCapabilities();
HashMap<String, String> bstackOptions = new HashMap<>();
bstackOptions.put("source", "selenide:sample-master:v1.2");
capabilities.setCapability("bstack:options", bstackOptions);
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");
options.addArguments("window-size=1400,800");
options.addArguments("disable-gpu");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new RemoteWebDriver(new
URL(String.format("https://%s:%s@hub-
cloud.browserstack.com/wd/hub", userName, accessKey)),
capabilities);
}
但是,功能是否会合并到Browserstack SDK YAML文件中存在的Chrome功能(并且它不起作用)
(b)这种变化会破坏与remotewebdriver挂钩的其他浏览式边缘和野生动物园会议
*请注意,这与这个问题类似,似乎没有回答这个问题: Remotewebdriver的设置语言-BrowserstackEndpoint
用Browserstack的SDK执行时,定义为browserstack.yml文件的功能将优先。 我们可以在每个浏览器的YML文件本身中定义浏览器特定参数。例如,