skip to content

Browser Sessions

Driving the phone's own browser rather than an app: which browser each of Android and iOS means by that, how the session asks for it, and the preferences you can set before the first page is loaded.

on this pageshow

explore

questions

5

In Appium, which browser does a `browserName` session drive on Android, and which on iOS?

level: juniorimportance: must knowfreq 70%

answer

  1. the browser is the app under test
  2. a capability, not an app artifact
  3. one browser per platform, not any browser
  4. Chromedriver on Android, Web Inspector on iOS

basics

~20 s

Sending browserName instead of an application makes the phone's own browser the app under test: Chrome on Android, whose page commands a Chromedriver answers, and Safari on iOS, driven by XCUITest through Apple's remote web inspector.

solid answer

~40 s

A browser session asks for a browser rather than an application artifact: you send the standard W3C capability `browserName` and leave the application out. On **Android** the drivers launch Chrome, whose package is `com.android.chrome`, and the page-level commands are answered by a **Chromedriver** process; the session reports its context as `CHROMIUM`, so your first find already runs against the page. On **iOS** the XCUITest driver launches **Safari** and drives the page through Apple's remote web inspector, and a small family of start-up preferences — `appium:safariInitialUrl`, `appium:safariAllowPopups` — shapes Safari before your first command arrives. Two platforms, two browsers, two bridges; only the WebDriver commands you send afterwards look the same.

go deeper

for a junior

Be ready to say in one line what browserName does: the phone's own browser becomes the application under test. Name the browser for each platform, Chrome on Android and Safari on iOS, rather than saying the mobile browser.

for a middle

Explain the mechanics underneath the capability: which package Android launches, which process answers the page commands on each platform, and why the Android session reports a CHROMIUM context from the start.

for a senior

Show you have operated these. Two bridges mean two failure modes, so a browser suite needs per-platform triage rather than one shared explanation whenever a page-level command starts failing.

for a principal

Own the framing that a mobile-web programme is two browsers, not one. Be explicit about what that costs in setup and maintenance, and about which coverage claims the team is entitled to make.

## A browser session names a browser, not an application Almost every Appium session names an application: the capability set carries an artifact, the driver installs it, and everything afterwards happens inside it. A **browser session** is the other shape. You send the standard W3C capability `browserName`, you leave the application artifact out, and the driver treats the phone's own browser as the application under test. Nothing of yours is installed, and the first command you send already runs against a web page instead of against a native view hierarchy. `browserName` is one of the twelve capability names the W3C reserves, so it travels **without** the `appium:` vendor prefix while nearly everything beside it in the same payload carries one. That is a useful tell when you read someone else's capability block: the unprefixed `browserName` is the line that turns the whole session into a web session. What makes this a topic rather than a footnote is that the word *browser* resolves to two different products, reached by two different bridges, depending on which platform the session asked for. ## Android means Chrome, and Chromedriver answers the web half On Android the browser Appium drives is Google Chrome, whose package is `com.android.chrome`. The Android drivers launch it, and the web half of the session — finding elements in the page, clicking them, reading the title — is answered by a **Chromedriver** process rather than by the on-device Android agent. The session reports its context as `CHROMIUM`, the name Appium gives a Chrome-backed web context. - `browserName` is the ask; `com.android.chrome` is the package that actually launches. - Chromedriver, not the on-device UiAutomator2 server, answers the page-level commands. - The context is `CHROMIUM`, so the driver is not looking at a native view tree when you start. - Chrome has to be present on the device or emulator image; there is nothing else for the session to open. - The `appium:safari*` capabilities mean nothing here — they belong to the other platform. ## iOS means Safari, and Apple's remote web inspector answers it On iOS the browser is **Safari** and the driver is **XCUITest**. XCUITest launches Safari and drives the page through Apple's remote web inspector — an Apple debugging facility, not a Chromedriver. Because Safari's start-up is under the driver's control, XCUITest also exposes preferences that apply *before* your first command lands: - `appium:safariInitialUrl` decides which page Safari is showing when the session hands control back to you. - `appium:safariAllowPopups` decides whether script-opened pop-up windows are allowed through. - `appium:nativeWebTap` decides whether a click on a web element becomes a real native tap at translated screen coordinates. - Once the session is running, `mobile: updateSafariPreferences` is the XCUITest execute method for changing Safari preferences mid-run. ## The two, side by side | | Android | Apple's side | |---|---|---| | Driver | UiAutomator2 and the Android drivers | XCUITest | | Browser | Chrome, package `com.android.chrome` | Safari | | Web bridge | a Chromedriver process | Apple's remote web inspector | | Context reported | `CHROMIUM` | not a `CHROMIUM` context | | Start-up preferences | no `appium:safari*` family | `appium:safariInitialUrl`, `appium:safariAllowPopups`, `appium:nativeWebTap` | The row that matters most in practice is the third one. Two different bridges means two different failure modes, two different sets of logs, and two different pieces of machinery to keep working as the platforms move. ## A worked case: the farm weigh-in dashboard Say the livestock-weighing product for farms ships a native weighing app and, beside it, a responsive weigh-in dashboard that farmhands open in whatever browser their phone came with. Checking that dashboard is exactly what a browser session is for. The Android job asks for `browserName` alongside the Android platform and gets Chrome; the iOS job asks for `browserName` alongside the Apple platform and gets Safari, and can be told to open `https://farm.example/weigh-in` immediately with `appium:safariInitialUrl`. From the moment each session is up, the code that types a weight, picks an animal tag and submits the record is ordinary WebDriver code and can be shared between them. What cannot be shared is the sentence "we tested it in *the* mobile browser". You tested it in two browsers, deliberately, because that is what the two platforms give you. ## Where this goes wrong 1. Treating `browserName` as a free choice of browser. Each platform answers with its own browser; the capability is how you ask for a browser session, not a menu of every browser on the handset. 2. Expecting an `appium:safari*` key to have an Android effect. Those keys are XCUITest's, and the Android side has no member of that family. 3. Writing one setup helper that hides the divergence, then being surprised that one page-level failure has two entirely different explanations underneath it. 4. Forgetting the device is still there: a browser session runs on a real device or emulator, with that device's screen size, keyboard and network conditions.

  • What happens on Android if the device image has no Chrome installed?
    There is nothing for the session to launch. A browser session on Android drives the installed `com.android.chrome`; it does not ship a browser of its own, so an emulator image without Chrome cannot serve one. Either use an image that carries Chrome, or accept that the Android half of the mobile-web suite cannot run on that device.
  • Once the iOS Safari session is running, how do you change a Safari preference?
    The XCUITest driver exposes `mobile: updateSafariPreferences` as an execute method, so preferences can be changed mid-session rather than only through capabilities. The `appium:safari*` capabilities are the before-the-first-page path; the execute method is the during-the-run path. Android's Chrome session has no member of either family.

saying these in an interview costs you the question

  • Says browserName can name any browser installed on the phone
  • Thinks a browser session still needs an app artifact installed
  • Believes Chromedriver answers the web commands on iOS as well
  • Assumes appium:safariInitialUrl has an effect on Android Chrome
  • Talks about the mobile browser without naming Chrome or Safari
open as a page

In Appium, what does `browserName` make the Android and iOS drivers do at session start?

level: middleimportance: must knowfreq 62%

basics

~20 s

browserName makes each driver start the platform's own browser and wire a web bridge to it: the Android drivers launch Chrome and proxy page commands to Chromedriver, while XCUITest launches Safari and drives it through Apple's remote web inspector.

open as a page

When should an Appium suite drive Chrome or Safari as the app under test rather than your own app?

level: seniorimportance: must knowfreq 55%

basics

~20 s

Drive the browser when the subject is the web property itself on a phone: the session asks for a browser, installs nothing, and starts on the page. It means Chrome on Android and Safari on iOS.

open as a page

In an Appium iOS Safari session, what does `appium:nativeWebTap` change about a tap on a web element?

level: seniorimportance: should knowfreq 45%

basics

~20 s

On iOS, appium:nativeWebTap makes XCUITest perform a real native tap at the web element's translated screen coordinates instead of clicking it inside the page, which is closer to a finger but depends on translating page coordinates past Safari's own chrome.

open as a page

How would you structure one Appium mobile-web suite when Chrome and Safari sessions need different capabilities?

level: principalimportance: should knowfreq 42%

basics

~20 s

Keep a thin shared block, then one explicit block per platform: only browserName and the standard W3C keys are truly shared, while the driver, the browser and every Safari preference diverge. Assert identical outcomes, never identical setup.

open as a page