Mobile Browser Automation using Selenium
On This Page Selenium for Mobile Browser AutomationFebruary 13, 2026 · 11 min read · Mobile Testing
A is inevitable for any business to flourish. The number of mobile users is greater than desktop users, as the incursion of mobile phones is more compared to computer. Wandering companies are unloosen new models with new pattern, screen resolutions, and processors every year to attract buyers. Hence, have always been challenging due to, nevertheless, it is an indispensable part of mobile development. Let ’ s understand how to streamline the examination by opting for using Selenium. is a democratic mechanization entourage for and Appium is the best when it come to automate mobile applications. To screen web applications in mobile browsers, Selenium can be used with the. In Selenium 3, JSON Wire protocol is apply to communicate with the web browsers while the web browsers act on W3C (World Wide Consortium) protocol. This take to APIs encoding and decoding at the client level. is an open-source instrument for automating native, mobile web, and hybrid applications on iOS, Android, and Windows. It is a server written on node.js that works on client-server architecture. According to the client-server architecture, the client connects to the server to avail of any service hosted on the waiter. Any communication between the client and server is in the form of responses and requests. Like Selenium, Appium also support multiple languages such as Java, Objective-C, JavaScript, PHP, Ruby, Python, and C #. To get started with peregrine web browser automation examination, you foremost ask to install Android SDK, Node.js, and Appium. Download Android SDK and set “ ANDROID_HOME ” path in System Environment Variables by following the below steps: Step 1& # 8211; Download Android SDK command-line puppet fromAndroid Studio functionary pagefor Windows/iOS. Step 2& # 8211; Create a folder as “Android” at the desired file location, simulate the command-line zip file in the“Android”folder and extract the contents. Step 3& # 8211; Within the“Android”folder, create a new leaflet “cmdline-tools”. And under “cmdline-tools” folder, make a “tools” folder. Step 4& # 8211; Now, move the extracted substance to the“Tools”brochure. Net contents of“tools”booklet should look like below. Step 5& # 8211; Navigate to the bin folder and open the command prompt. Type “ sdkmanager & # 8211; lean ”. This will show a leaning of installed, valid bundle as well as those that can be updated. Step 6& # 8211; To establish the platform tools type below bid in dictation prompting “33”is the up-to-the-minute Android API adaptation. To choose an API version of the Android device under test, referAndroid version history Wikipedia page. Step 7& # 8211; After the platform tools are download, “platforms” and “ platform-tools ”folders should be populate under“ Android folder ”. “ platform-tools ”contains “adb.exe” which helps in find the Android device when connect to the system. Step 8& # 8211; Set “ANDROID_HOME” path in the scheme surround variable. Step 9& # 8211; Go to Settings in the Android phone under test and enable the “Developer Options” so that scheme can observe the earphone when connected. Step 10& # 8211; Connect the phone via USB cable, open the command prompting in the system, and typewrite the command as “adb device” to get the list of devices attached. Step 1& # 8211; Download Node.js from itsofficial page. Once downloaded, run the installer. This will establish node.js and npm and will be available under the “C: \Program Files\nodejs” folder in the scheme. Step 2& # 8211; To check whether node is installed open a new command prompt and type. Step 3& # 8211; To insure whether node is installed type Step 4& # 8211; To establish Appium enter below command on the command prompt. For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users. Step 5& # 8211; Once download, check that Appium is installed by typing the dictation Step 6& # 8211; Type “appium” and hit Enter. The Appium server should start on localhost port 4723 which is the default port for Appium. To quit the Appium server insistence “Ctrl+C”. The twist is connected to the scheme, listed via adb and the Appium server is also lam. Now you can start with the first Mobile web browser automation script. Step 1& # 8211; In any Java editor, create a Maven project and add Selenium Java, Java guest and TestNG addiction under& lt; dependencies & gt; tag in pom.xml. Step 2& # 8211; Under “src/test/java” create a package and under that software, create a class as “AndroidChromeTest”. Step 3& # 8211; Create a WebDriver case as we do in Selenium Web automation. Step 4& # 8211; Create a ChromeOptions case to set Chrome Driver and Android device details. Step 5& # 8211; Create a URL class case to store the speech of Appium server. Step 6& # 8211; Create AndroidDriver instance and pass Appium remote server address and Desired Capabilities instance. Step 7& # 8211; Below code set the desired details for the Android device and Chrome browser nowadays in Android device Step 8& # 8211; This completes the apparatus and we are good to start interacting with the browser. Below code launching BrowserStack official website, and verifies that the title is as await or not. Above program demonstrates testing of Mobile Chrome browser in Android Phone. To test in any other OS or browser Desired Capabilities should be set consequently. Websites are built using different technologies such as HTML, Javascript, CSS, PHP, etc. Every browser has its own engine to render web pages. With this, it is evident it will charge, carry, and look slimly different in different browsers. verifies that the website is supply properly across multiple browsers and is crucial for ensuring that the ware experience is consistent. In the parallel domain, Web Browser companionship are releasing new versions of browsers really oftentimes. Again, testing websites against new browser versions is obligatory. Implementing cross-browser examine manually seems impossible as there is a pool of mobile device case, platforms (Android/ iOS), browser eccentric (Chrome/ Firefox/ Safari), and browser versions uncommitted in the market. along with the TestNG model can be used by pass browser values from testing.xml file and with the assistant of @ Parameters annotating. leverages testing of mobile/web service by render 3000+ real devices and browsers for comprehensive examination of the website and roving applications for functionality, performance, and visual charm to release bug-free software faster and at scale. Testers can easy trade between device, platforms, browser, and browser variation thereby achieving cross-platform and crisscross browser examination. offers 3500+ existent browser and devices to prove on using its. Testing on helps you get exact test results. Here are the steps to test roving web browser on BrowserStack Automate: Step 1& # 8211; and create a gratuitous account. After successful chronicle creation, you can view the Authentication and Security details under the Summary tab. Step 2& # 8211; Navigate to Capabilities Generator page to select from a comprehensive set of options. Step 3& # 8211; Choose your coveted combination of device-browser from thousands of uncommitted combinations. In the below example, Android Google Pixel 6 Pro, OS 13 with Chrome browser are selected. Step 4& # 8211; In any java editor, create a Maven project and add Selenium Java and Java client dependence. Below program showcases the Chrome browser essay on Google Pixel 6 Pro on the real device cloud. Below programme illustrates Safari browser test on iPhone 11 the real device cloud. After running the above programs, you can check the upshot on the page. You also get to see the execution video. You can get access to text, network, and former log. And it captures Appium logarithm too! In short, all the surroundings details and desired capabilities are available for each run on the Automate splashboard page. After seeing the above implementation it & # 8217; s quite evident that BrowserStack facilitates QA team to action on multiple browsers to do certain the build meets browser compatibility benchmark. It decimate the complexness of downloading Android SDK, Appium, and Node to reach web mobile automation examine in a traditional way. You should run Selenium Java Tests on a real twist cloud like for below reasons: In today ’ s software mechanization world, uninterrupted maturation, and continuous deployment is the key objective of development environments. and are the two democratic and potent testing automation creature that help testers integrate continuous testing. It supports multiple browser, program, and go systems. As the gatekeeper of any product, it is the responsibility to test the product on existent devices, program, and browsers before release it in production. BrowserStack speak all these concerns by providing 3000+ real devices and browser. It supports cross-browser examination and deliver a seamless user experience across browsers and device. # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.Mobile Browser Automation using Selenium
Selenium for Mobile Browser Automation
Getting Started with Mobile Browser Automation Testing
Selenium Mobile Browser Automation
1. Install and Configure Android SDK
sdkmanager “ platform-tools ” “ platforms; android-33 ”
2. Install Node.js and Appium Server
node -v
npm -v
npm install -g appium
appium -v
3. Write Mobile Web Browser Automation Test Script
& lt; dependencies & gt; & lt; dependency & gt; & lt; groupId & gt; org.seleniumhq.selenium & lt; /groupId & gt; & lt; artifactId & gt; selenium-java & lt; /artifactId & gt; & lt; variation & gt; 4.5.0 & lt; /version & gt; & lt; /dependency & gt; & lt; dependency & gt; & lt; groupId & gt; io.appium & lt; /groupId & gt; & lt; artifactId & gt; java-client & lt; /artifactId & gt; & lt; version & gt; 8.2.0 & lt; /version & gt; & lt; /dependency & gt; & lt; dependency & gt; & lt; groupId & gt; org.testng & lt; /groupId & gt; & lt; artifactId & gt; testng & lt; /artifactId & gt; & lt; variation & gt; 7.6.1 & lt; /version & gt; & lt; scope & gt; compile & lt; /scope & gt; & lt; /dependency & gt; & lt; /dependencies & gt;
WebDriver driver;
ChromeOptions options=new ChromeOptions ();
URL url=new URL (``http: //localhost:4723/wd/hub");
driver = new AndroidDriver (url, options);
@ BeforeMethod public void setUp () shed MalformedURLException {options.setPlatformName (`` Android ''); options.setAndroidDeviceSerialNumber (`` N000TA1183962301141 ''); options.setBrowserVersion (`` 106 ''); //Appium server details url = new URL (`` http: //localhost:4723/wd/hub ''); driver = new AndroidDriver (url, pick);}@ Test public void verifyTitle () throws MalformedURLException {driver.get (`` https: //www.browserstack.com/ ''); Assert.assertEquals (driver.getTitle (), `` Most Reliable App & amp; Cross Browser Testing Platform | BrowserStack '');}Why is Cross Browser testing necessary?
Selenium for Cross-Browser Testing
Using BrowserStack to achieve Cross Browser Testing
How to Test Mobile Web Browsers on BrowserStack Real Device Cloud
& lt; dependencies & gt; & lt; dependency & gt; & lt; groupId & gt; org.seleniumhq.selenium & lt; /groupId & gt; & lt; artifactId & gt; selenium-java & lt; /artifactId & gt; & lt; edition & gt; 4.5.0 & lt; /version & gt; & lt; /dependency & gt; & lt; dependance & gt; & lt; groupId & gt; io.appium & lt; /groupId & gt; & lt; artifactId & gt; java-client & lt; /artifactId & gt; & lt; edition & gt; 8.2.0 & lt; /version & gt; & lt; /dependency & gt; & lt; dependence & gt; & lt; groupId & gt; org.testng & lt; /groupId & gt; & lt; artifactId & gt; testng & lt; /artifactId & gt; & lt; version & gt; 7.6.1 & lt; /version & gt; & lt; reach & gt; compile & lt; /scope & gt; & lt; /dependency & gt; & lt; /dependencies & gt;
public class AndroidTestBS {public static String username = `` & lt; browserstack_username & gt; ''; public static String accesskey = `` & lt; browserstack_accesskey & gt; ''; public static final String URL = `` https: // '' + username + ``: '' + accesskey + `` @ hub-cloud.browserstack.com/wd/hub ''; WebDriver driver; String url = `` https: //www.browserstack.com/ ''; MutableCapabilities capabilities = new MutableCapabilities (); HashMap & lt; String, Object & gt; browserstackOptions = new HashMap & lt; String, Object & gt; (); @ BeforeMethod public void setUp () throws MalformedURLException {browserstackOptions.put (`` browserName '', `` chrome ''); browserstackOptions.put (`` deviceName '', `` Google Pixel 6 Pro ''); browserstackOptions.put (`` realMobile '', `` true ''); browserstackOptions.put (`` osVersion '', `` 13 ''); capabilities.setCapability (`` bstack: pick '', browserstackOptions); driver = new RemoteWebDriver (new URL (URL), capabilities);} @ Test (precedence = 1) public void verifyTitle () {driver.get (url); System.out.println (driver.getTitle ()); Assert.assertEquals (driver.getTitle (), `` Most Reliable App & amp; Cross Browser Testing Platform | BrowserStack '');} @ Test (priority = 2) public void verifyDashboard () {driver.get (url); WebElement getStarted = driver.findElement (By.cssSelector (`` a # signupModalButton '')); getStarted.click (); Assert.assertEquals (driver.getTitle (), '' Get Started For Free & amp; Access 3000+ Mobile Devices & amp; Browsers | BrowserStack '');} @ AfterMethod public emptiness tearDown () {driver.quit ();}}@ BeforeMethod public void setUp () shed MalformedURLException {browserstackOptions.put (`` browserName '', `` safari ''); browserstackOptions.put (`` deviceName '', `` iPhone 11 ''); browserstackOptions.put (`` realMobile '', `` true ''); browserstackOptions.put (`` osVersion '', `` 14 ''); capabilities.setCapability (`` bstack: choice '', browserstackOptions); driver = new RemoteWebDriver (new URL (URL), capabilities);}Why use BrowserStack Automate to run Selenium Tests?
Conclusion
Related Guides
Automate This With SUSA
Test Your App Autonomously