如何在Serenity託管的Chrome驅動程序中設置Nexus 5視圖的移動模擬?在Chrome驅動程序的serenity.properties文件中設置設備名稱
我試圖要通過此鏈接: https://johnfergusonsmart.com/configuring-chromedriver-easily-with-serenity-bdd/
這解釋了鍍鉻設置首選項。
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
和其他一些邏輯變種,但沒有一個成功的。