Running Automation script in mobile chrome browser for web apps.
- Mobile web application is also called as mobile website and it can be accessed through mobile web browser by hitting the URL.
- We have to set the desired capabilities to build a communication between appium and devices.
- For initializing the execution of automation scripts in chrome browser mobile, we need “chromedriver.exe”.
Below Desired capabilities:
//Setting up the connected device name
capabilities.SetCapability("deviceName", "emulator-5554");
//Setting up the browser name
capabilities.SetCapability(MobileCapabilityType.BrowserName, MobileBrowserType.Chrome);
//Giving path of the chromedriver.exe to initialize the
chrome browser in mobile.
string DirParent = System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName;
string chromePath = DirParent+ "//chromedriver.exe";
capabilities.SetCapability("chromedriverExecutable", chromePath);
//Initializing appium server in mobile
appdriver = new AndroidDriver<AndroidElement>(new Uri("http://127.0.0.1:4755/wd/hub"), capabilities);
Thread.Sleep(2000);
//Navigating to url in mobile chrome
browser
appdriver.Navigate().GoToUrl("www.qalearningguide.com");