I am launching chrome app using the following desired capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Android");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity", "com.google.android.apps.chrome.ChromeTabbedActivity");
capabilities.setCapability("disable-popup-blocking", true);
driverC = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
I wish to know the capabilities required to launch chrome app with Request desktop site check box enabled.
Screen for referrence:
In Mobile automation, to automate the browser in Desktop mode we can perform with the help of user-agent.
Steps to follow:
Find the user agent for your device and browser. In your device/emulator navigate to the find my user agent website and it automatically displays the user agent as below. (make a note of it)
Add the above user agent to the ChromeOptions with the help of --user-agent flag. Then assign the flag option with the desired capabilities as below.
On the user agent you can add all the browsers OR the one you wanted to automate.
CODE:
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.0");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus_10");
caps.setCapability("chromedriverExecutable","\\driver\\chromedriver_74.exe");
caps.setCapability(MobileCapabilityType.BROWSER_NAME, "chrome");
ChromeOptions options = new ChromeOptions();
options.addArguments("--user-agent=Chrome/74.0.3729.185");
caps.setCapability(ChromeOptions.CAPABILITY, options);
url = "http://127.0.0.1:4723/wd/hub";
driver = new AndroidDriver<>(new URL(url), caps);
Now run the program and verify the execution. The browser automatically opens in desktop mode on the automation device.
(This was performed with the Java language and similar approach could be performed with the other languages)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With