In my appium mobileweb test automation project (Appium v3.2, JDK 21) with real devices like Android with Chrome browser ( Android v16.0 Samsung Galaxy S21 FE, Chrome v147.0), and iOS with Safari browser, particularly while using Android device zooming is happening. Meaning while a specific page control is in focus for either click or data entry, page takes zoom in to view it closer and bigger. This has a side effect of losing sight of other page controls out of the view. As like in iPhone, I would like to have a full view of the complete web page at all the time.
-
Why is it happening ?
-
Is it a feature of the web page I was testing or the Chrome browser on this Android ?
-
Is this the new feature introduced with Appium 3.2 ?
-
Is itIs there a configuration setting which disables this feature ?
I believe this is pure Chrome behavior. Try add ChromeOptions
// Disables the 'magnifier' or zoom behavior in some Chrome versions
options.addArguments("--disable-notifications");
options.addArguments("--disable-feature=AutofillServerCommunication");
// Sometimes forcing a specific window size prevents the jumpy zoom
options.addArguments("--window-size=1080,1920");
// also try ->
options.addArguments("--disable-features=AccessibilityFocusHighlight");
options.addArguments("--force-device-scale-factor=1");
options.addArguments("--disable-pinch");
options.addArguments("--enable-viewport");
@Aleksei
It helped the problem exactly.
Appreciate your help thousand times.
I used it like this:
//--> To prevent zooming and other unwanted behaviors in mobile Chrome
Map<String, Object> chromeOpts = new HashMap<>();
List<String> chromeArgs = new ArrayList<>();
chromeArgs.add("--disable-notifications");
chromeArgs.add("--disable-features=AutofillServerCommunication");
chromeArgs.add("--disable-features=AccessibilityFocusHighlight");
// chromeArgs.add("--force-device-scale-factor=1");
chromeArgs.add("--disable-pinch");
// chromeArgs.add("--window-size=1080,1920");
chromeOpts.put("args", chromeArgs);
// Set experimental options to disable autofill and accessibility features that can interfere with tests
andyOptions.setChromeOptions(chromeOpts);
//<-- To prevent zooming and other unwanted behaviors in mobile Chrome
With out commenting the two lines above, would make my mobileweb testing in to plain web testing, meaning it is rendering the web site as it is on the mobile, loosing the responsive nature of the website. The advantage of adopting a single web site for multiple devices is one thing, and we would like to keep and test it.