Reputation: 97
I am new to Appium. I am trying to run a test using Appium test case on my Android emulator to open Chrome browser and search for "google.com"
I have tried many things to resolve my issue:
1.update chrome on my Android emulator browser
2.update the Maven dependencies and the java client
3.restarting appium server.
and many things more
I am attaching both pics and posting the code for easier analyzing of the problem.
TestWebBrowser.java Code:
public static AppiumDriver<MobileElement> driver;
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Test_Demo");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
driver = new AndroidDriver<MobileElement> (new URL("https://127.0.0.1:4723/wd/hub"), capabilities);
driver.get("http://google.com");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.quit();
}
POM.xml Appium dependency used:
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
</dependencies>
Error Description below (thought a pic would be better than copy-paste of the error):
Please let me know if I am doing anything fundamentally wrong. It might be a noob mistake. But couldn't find much help with the other stackoverflow questions.
Upvotes: 2
Views: 3038
Reputation: 113
Check your virtual device version if its Android-Version is 9.0+. Then create another device with a version equal to Android 9(Pie) or less than that and try it again. As the latest android version is causing some issues so I tried it with Android 9 which works for me. In the same way, don't go for the latest device as well.
Upvotes: 0
Reputation: 2526
Following dependencies are required for appium:
Please add the following dependencies in your pom.xml file:
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
Also make sure your appium server is running in 127.0.0.1:4723
Upvotes: 2
Reputation: 188
In your JAVA code did you add Selenium Jars? If not then add all selenium Jars and try again, it will work.
Selenium Jars are commonly used for web automation but for Android automation and desired capabilities we require some aspects of web as well, hence selenium Jars must be used in Android Automation.
Upvotes: 2