android


unknown error: Unsupported locator strategy: -android uiautomator


I am automating mobile web application using Appium Server and Selenium.
All I want to do is to retrieve the titles of android notification, to achieve this i tried to using the locator: findElementsByAndroidUIAutomator to identify an element using resourceId.
Below is the code written by me:
package com.roofandfloor.test;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.MobileBy;
import io.appium.java_client.android.AndroidDriver;
public class test02 {
public static void main(String[] args) throws MalformedURLException, InterruptedException {
DesiredCapabilities desc = null;
URL url = null;
desc = new DesiredCapabilities();
desc.setCapability("automationName","Appium");
desc.setCapability("platformName", "Android");
desc.setCapability("platformVersion", "5.0");
desc.setCapability("deviceName", "Lenovo K50a40");
desc.setCapability("browserName", "Chrome");
desc.setCapability("appPackage", "com.android.chrome");
desc.setCapability("appActivity", "com.google.android.apps.chrome.Main");
url = new URL("http://0.0.0.0:4723/wd/hub");
AndroidDriver driver = new AndroidDriver(url,desc);
driver.openNotifications();
Thread.sleep(5000);
List<WebElement>allNotifications=driver.findElementsByAndroidUIAutomator("new UiSelector().resourceId(\"android:id/title\")");
System.out.println(allNotifications.size());
}
}
When I run the above code I am getting the error shown below:
org.openqa.selenium.WebDriverException: unknown error: Unsupported locator strategy: -android uiautomator
I have alternatively tried to use the below code.
List<WebElement>allNotifications=driver.findElements(MobileBy.AndroidUIAutomator("new UiSelector().resourceId(\"android:id/title\")"));
I am getting the same error as above.
Please help me resolving the issue.

Related Links

List View custom row
Android Webview doesn't open some URLs
Parse Android query for objects created within month
Image to ListView
SharedPreferences for checking the logged in value
How to handle shouldInterceptRequest parameter change in API21?
AuthenticationActivity has leaked window org.chromium.content.browser.input.PopupTouchHandleDrawable
How does Android maintain the linkage info between R constant and the actual file?
Android Overlapping Image Views and clickable
How to add a third text view to list view elements using custom list adapter
Android multiple searchview's one layout has alignment issues, how do I get the listview
How to avoid jerk when notifyDataSetChanged method of adapter is called?
Move Android Studio project directory up
NPE at getSupportActionBar() on OnePlus One Running Android 5.1
How to send a json to asp.net api Controller from android studio app?
I can't edit studio.exe file in Android Stuido 1.3

Categories

HOME
algorithm
notepad++
go
fabricjs
search
datastore
mjml
character-encoding
battery
composite-primary-key
socket.io
can
edge
visual-studio-emulator
modal-dialog
okhttp
pega
x-cart
atlassian
selectize.js
internationalization
mathprog
symbols
question2answer
mongoid6
gmock
maze
asymptotic-complexity
genexus-sd
nsurl
magento-1.8
autodesk-designautomation
complex-numbers
cart
playstation-portable
simplecv
sammy.js
carriage-return
modalviewcontroller
baidu-map
latitude-longitude
amazon-ses
android-ibeacon
sharp-snmp
lpsolve
contract
flask-login
geotiff
activeperl
qtranslate
wpas
semantic-logging
check-mk
lsyncd
monkey
gpg-signature
objectscript
simplepie
webjars
jtwig
deep
html-to-pdf
jparsec
linklabel
computer-architecture
microsoft-reporting
evolus-pencil
iced-coffeescript
alloy-ui
beatsmusic
android-cookiemanager
pseudo-class
tweenlite
renderer
windows-embedded-standard
ora-06550
neos-server
android-icons
cascadingdropdown
apache-abdera
android-loadermanager
mapping-by-code
fitbounds
automationelement
exponentiation
strsep
msr
undefined-index
resharper-6.0
qtabbar
filesystemobject
silverlight-oob
mathematical-typesetting
wspbuilder

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile