如何在 Serenity 托管 chrome 驱动程序中为 Nexus 5 视图设置移动仿真?
我尝试通过此链接: https ://johnfergusonsmart.com/configuring-chromedriver-easily-with-serenity-bdd/
这解释了 chrome 的设置首选项。
Chrome preferences
You can also provide more advanced options using the setExperimentalOption() method:
Map<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("download.default_directory", downLoadDirectory);
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("pdfjs.disabled", true);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
In Serenity, you would pass these using properties prefixed with the chrome_preferences prefix, e.g.
chrome_preferences.download.default_directory = /my/download/directory
chrome_preferences.profile_default_content_settings.popups = 0
chrome_preferences.pdfjs.disabled=true
由此,我尝试将 mobileEmulation 设置为
chrome.capabilities.mobile_emulation.device_name= Google Nexus 5
chrome.options.mobileEmulation.deviceName= Google Nexus 5
和其他一些逻辑变体,但没有一个成功。