One of our internal applications has a flash object on a page. I need to test one of the corner cases when there is no flash plugin available/installed in the browser: n
chrome://plugins doesn't exist anymore in Chrome 57 and above. Method proposed by alecxe in accepted answer unfortunately doesn't work for me.
I was able to workaround this issue by turning on mobile emulation on ChromeDriver. Example code for some languages can be found here: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation
Example code for java from the above page:
Map mobileEmulation = new HashMap();
mobileEmulation.put("deviceName", "Google Nexus 5");
Map chromeOptions = new HashMap();
chromeOptions.put("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
You can also specify your own screen resolution, pixel ratio and even userAgent.
Map deviceMetrics = new HashMap();
deviceMetrics.put("width", 1920);
deviceMetrics.put("height", 1080);
deviceMetrics.put("pixelRatio", 1.0);
Map mobileEmulation = new HashMap();
mobileEmulation.put("deviceMetrics", deviceMetrics);
mobileEmulation.put("userAgent", "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19");
Map chromeOptions = new HashMap();
chromeOptions.put("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
This will work with RemoteWebDriver also.