Unit 3: Android Native Apps Automation with Appium - Practice Quiz
1 Which locator uses the resource-id of an Android element?
2 Which locator is commonly used to find an element by its accessibility label?
3 What does XPath describe when locating an element in an Android app?
4 Which Appium method is commonly used to return all matching elements?
5 What is a common way to handle an Android alert popup?
6 Which Appium method extracts the visible text from an element?
7 Which method is used to enter text into an input field?
8 What is the main purpose of an automated test case?
9 Which app feature is suitable for an Appium test?
10 What should a shopping form test verify after entering valid details?
11 Which action enters a customer's name into a shopping form field?
12 What is a toast message in an Android application?
13 What should a test verify when a required form field is empty?
14 Why is scrolling used in a product list test?
15 Which gesture moves the product list toward lower items?
16 How can a test dynamically select a product from a list?
17 What should happen when the required product text is found?
18 What does a total amount validation usually compare?
19 Which values may be used to calculate a shopping total?
20 Why are user-defined functions useful in Appium test code?
21
An Android element has the resource ID com.shop.app:id/cartButton. Which Appium locator is the most direct choice?
AppiumBy.className("com.shop.app:id/cartButton")
AppiumBy.id("com.shop.app:id/cartButton")
AppiumBy.xpath("//*[@text='cartButton']")
AppiumBy.accessibilityId("com.shop.app:id/cartButton")
22
A button has no resource ID but exposes the content description Checkout. Which locator should be preferred?
AppiumBy.id("Checkout")
AppiumBy.xpath("//*[@id='Checkout']")
AppiumBy.className("Checkout")
AppiumBy.accessibilityId("Checkout")
23 When is XPath most appropriate for locating an Android element?
24
A test must tap Allow on an Android permission popup only when the button appears. Which approach best avoids an exception when the popup is absent?
findElement and assume the popup exists
navigate().back() before checking the popup
getPageSource and tap fixed coordinates
findElements and check whether the list is empty
25
What does driver.findElements(AppiumBy.className("android.widget.TextView")) return when no matching elements are present?
NoSuchElementException immediately
26
A test needs to replace an existing value in a mobile text field with Alex. Which sequence is most reliable?
click() and then getText()
getText() and then clear()
clear() and then sendKeys("Alex")
submit() and then sendKeys("Alex")
27
A price label displays $45.50. Which method should first be used to retrieve the displayed value for validation?
priceElement.isSelected()
priceElement.getText()
priceElement.getSize()
priceElement.sendKeys()
28 Which test case provides the strongest functional coverage for a shopping app's cart feature?
29 A checkout feature accepts customer details and creates an order. Which scenario is the best candidate for an end-to-end Appium test?
30
A shopping form contains country, name, gender, and a Shop button. What should the test do before tapping Shop in a valid submission scenario?
31
A country dropdown contains many values and Argentina is initially off-screen. Which test sequence is most appropriate?
Argentina, and select it
Argentina into the customer name field
32 A form displays a short Android toast after submission with an empty name. Which XPath can locate any visible toast element?
//android.widget.Button
//android.widget.Spinner
//android.widget.EditText
//android.widget.Toast
33 Why should an explicit wait be used when validating a toast message?
34
Which Android UIAutomator expression scrolls a scrollable container until the product text Jordan 6 Rings is visible?
new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Jordan 6 Rings"))
new UiScrollable().text("Jordan 6 Rings").sendKeys(true)
new UiSelector().scrollable(false).clickable("Jordan 6 Rings")
new UiSelector().resourceId("Jordan 6 Rings").scroll(false)
35
After scrolling to an off-screen product, what should the test verify before tapping its Add to Cart control?
36
A page contains several product cards, each with a title and an Add to Cart button. How should a test select the card titled Converse All Star?
37
While scanning visible product elements, which condition correctly identifies a requested product stored in targetName?
productName.getSize().equals(targetName)
productName.isSelected() == false
productName.getText().isEmpty()
productName.getText().equals(targetName)
38
A cart displays item prices $120.50 and $79.50, with no tax or discount. What total should the test expect?
$200.00
$190.00
$210.00
$201.00
39
Which approach is most reliable for validating a cart total from labels such as $1,250.75 and $249.25?
40 Several tests repeatedly scroll to a product name and add that product to the cart. Which helper design best reduces duplication?
addProductToCart(String productName)
addFirstProductToCart()
restartAppBeforeProduct()
storeProductScreenSize()
41
An Android login button has a build-dependent resource ID, a stable content-desc of submit-login, and visible text that changes with localization. Which locator is most resilient across builds and languages?
By.xpath("//android.widget.Button[1]")
By.xpath("//android.widget.Button[@text='Login']")
By.id("com.example:id/generated_42")
AppiumBy.accessibilityId("submit-login")
42
A screen contains several product cards, each with a product name and an ADD TO CART button. Which XPath selects the button belonging specifically to the card containing Air Jordan 4?
//android.widget.TextView[@text='Air Jordan 4']/following::android.widget.Button[1]
//android.view.ViewGroup[.//android.widget.TextView[@text='Air Jordan 4']]//android.widget.Button[@text='ADD TO CART']
(//android.widget.Button[@text='ADD TO CART'])[1]
//android.widget.Button[@text='ADD TO CART' and @index='4']
43
The inspector reports the resource ID com.shop.qa:id/cart, while the same app is installed under different package names in QA and staging. Which strategy best avoids embedding the environment-specific package?
By.id("cart") and let UiAutomator2 resolve the current application package
By.xpath("//*[@resource-id='cart']") because XPath ignores package names
By.className("cart") because class names are independent of application packages
AppiumBy.accessibilityId("cart") because every ID is also a content description
44 A promotional popup may or may not appear after login. The test must dismiss every currently matching close button without failing when none exists. Which approach has the correct absence semantics?
findElement until an exception confirms that every popup has disappeared from the current and all future screens
findElements, iterate over the returned list, and click displayed matches
findElement, catch NoSuchElementException, and reuse the returned element
45
An Android runtime permission dialog can display either While using the app or Allow depending on the OS version. Which solution is most maintainable when the permission interaction itself must remain under test?
autoGrantPermissions=true so the dialog is never exercised during the test
46
A prefilled quantity field must be changed from 10 to 2, and the test must ensure that the old value is not retained. Which interaction sequence is most reliable?
sendKeys("2"), wait one second, and expect the control to replace 10 automatically
clear(), call sendKeys("2"), and verify the resulting field value
getText(), append 2, and send the combined string back to the field
2 through the element's class name
47
A form validates an email only after the input loses focus. sendKeys() enters the email correctly, but the validation label never appears. What should the test do next?
getText() repeatedly on the email field until the label is automatically created
sendKeys() so the field emits a second focus event
48 A shopping test depends on a cart left populated by an earlier test and fails when executed alone. Which redesign best improves reliability while preserving meaningful coverage?
49
A country selector is implemented as a scrollable modal. Several visible elements partially match United, but the test requires exactly United Kingdom. Which approach minimizes selecting the wrong country?
United into the name field and assume the selector infers the country
United and click the first returned match
50
After completing a shopping form, the Proceed button remains covered by the soft keyboard and an attempted click is intercepted. Which remedy best represents the user's intended flow?
Proceed is clickable, and then click it
51
A toast saying Please enter your name appears for less than two seconds after submitting an empty form. Which validation is most suitable with UiAutomator2?
//android.widget.Toast[@text='Please enter your name']
TextView containing the message
findElements before submission and retain the list until the toast is displayed
52
A test checks a toast using contains(@text,'error'), but it passes for both Payment error and No error detected. Which change makes the assertion unambiguous?
android.widget.Toast class and ignore the returned message
error after the toast disappears
53
Which UiAutomator expression most directly scrolls a scrollable Android container until the product text Jordan 6 Rings is brought into view?
new UiSelector().className("Jordan 6 Rings").swipeIntoView(true)
new UiScrollable(new UiSelector().text("Jordan 6 Rings")).scrollForward(0)
new UiSelector().scrollable(false).click(new UiSelector().text("Jordan 6 Rings"))
new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Jordan 6 Rings"))
54
A custom product list does not expose scrollable=true, so the test uses repeated swipe gestures. How should the search terminate safely when the product is absent?
findElement eventually returns the requested product
55
A virtualized list recycles product-card elements during scrolling. Why should the test avoid storing all card WebElement references before scanning later pages?
WebElement reference per Android class at a time
56
Two products share the visible name Running Shoe but have different SKU values in their card descriptions. The requested SKU is RS-204. Which selection strategy is correct?
Running Shoe
204
57
A cart contains one item priced at $19.99 and two items priced at $5.50 each. Ignoring tax and shipping, what total and numeric strategy should the automated test use?
$30.99, computed with decimal-safe arithmetic such as BigDecimal
$30.99, computed by comparing only raw formatted strings without parsing
$30.98, computed by truncating each floating-point operation
$31.00, computed by rounding every item price to an integer first
58
The UI shows prices using the locale-specific strings €1.234,50 and €10,25. What is the most reliable way to validate their generated total?
59 A cart total updates asynchronously after quantity changes. Which assertion design best distinguishes a correct recalculation from a stale value?
+ and compare it with the previous total
60
Several tests need a helper selectProduct(name) that scrolls and clicks the matching product. Which design best supports reuse and reliable failure reporting?
true regardless of whether the click succeeds
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →