Issues with the AndroidDriver Selenium library and the inability to parse the AndroidManifest.xml file are causing problems

Trying to execute the sample test provided at https://code.google.com/p/selenium/wiki/AndroidDriver#Run_the_Tests on an Android emulator (Mac) is causing issues during the test run.

After setting up an emulator and installing the WebDriver APK, creating a new Android Application Project in Eclipse, and generating a class OneTest.java with imported org.openqa.selenium.WebDriver; which was initially missing from the code, along with importing the selenium-java-2.33.0 jars into the library, I updated my androidmanifest as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.test.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <uses-library android:name="android.test.runner" />
    </application>
    <instrumentation android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="com.example.test" />
</manifest>

When attempting to run OneTest.java as an Android Junit Test, an error showed:

[2013-07-25 11:53:36 - Test] The library 'selenium-java-2.33.0.jar' contains native libraries that will not run on the device.
[2013-07-25 11:53:36 - Test] The following libraries were found:
[2013-07-25 11:53:36 - Test]  - org/openqa/selenium/firefox/amd64/libibushandler.so
[2013-07-25 11:53:36 - Test]  - org/openqa/selenium/firefox/amd64/x_ignore_nofocus.so
[2013-07-25 11:53:36 - Test]  - org/openqa/selenium/firefox/x86/libibushandler.so
[2013-07-25 11:53:36 - Test]  - org/openqa/selenium/firefox/x86/x_ignore_nofocus.so

Disregarding the error and re-running the test resulted in:

[2013-07-25 11:59:43 - Test] Installing Test.apk...
[2013-07-25 11:59:44 - Test] Installation failed due to an invalid APK file!
[2013-07-25 11:59:44 - Test] Please refer to logcat output for more details.
[2013-07-25 11:59:44 - Test] Launch canceled!

LogCat displayed:

07-25 10:59:44.188: D/zipro(23141): Zip: EOCD not found, /data/local/tmp/Test.apk is not zip
07-25 10:59:44.188: D/asset(23141): failed to open Zip archive '/data/local/tmp/Test.apk'
07-25 10:59:44.219: W/PackageParser(23141): Unable to read AndroidManifest.xml of /data/local/tmp/Test.apk
07-25 10:59:44.219: W/PackageParser(23141): java.io.FileNotFoundException: AndroidManifest.xml
07-25 10:59:44.219: W/PackageParser(23141):     at android.content.res.AssetManager.openXmlAssetNative(Native Method)
07-25 10:59:44.219: W/PackageParser(23141):     at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
07-25 10:59:44.219: W/PackageParser(23141):     at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
07-25 10:59:44.219: W/PackageParser(23141):     at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:733)
07-25 10:59:44.219: W/PackageParser(23141):     at com.android.defcontainer.DefaultContainerService$1.getMinimalPackageInfo(DefaultContainerService.java:171)
07-25 10:59:44.219: W/PackageParser(23141):     at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:110)
07-25 10:59:44.219: W/PackageParser(23141):     at android.os.Binder.execTransact(Binder.java:351)
07-25 10:59:44.219: W/PackageParser(23141):     at dalvik.system.NativeStart.run(Native Method)
07-25 10:59:44.219: W/DefContainer(23141): Failed to parse package

An attempt was made to resolve this by following advice from How to solve library issue(s) in Selenium?, using android_webdriver_library.jar instead. However, errors arose concerning import org.openqa.selenium.android.AndroidDriver; and WebDriver driver = new AndroidDriver(); While the first error was fixed by employing android.AndroidWebDriver;, resolving the issue with AndroidDriver() proved challenging.

Any guidance would be appreciated since I am unfamiliar with Eclipse/Android development :)

Edit: Progress was made by adding:

<uses-permission android:name="android.permission.INTERNET" /> 

To the manifest, yet encountered the error "Could not find class 'org.openqa.selenium.android.AndroidDriver', referenced from method com.example.test.OneTest.testGoogle

Answer №1

By developing a Java Project and incorporating a main method, I successfully resolved the majority of my issues. To ensure smooth operation, I made sure to import selenium-server-standalone-2.33.0.jar as not doing so would result in errors during testing.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Leverage SQLite database in React-Native for Android development on Windows platform

I have been experimenting with a demo app in React-Native that includes the usage of SQLite Database. Following the instructions from this link, I tried running the command npm install --save react-native-sqlite-storage in my project's main repository ...

Using Python Selenium to Download an Image to a Local Directory

What is the best way to transfer an image from a source to a local folder using Python with Selenium? I could use some assistance, thank you in advance. ...

Unable to execute automated testing for registration form including reCaptcha using Selenium in JAVA

Need assistance with bypassing reCaptcha on my registration form. I've automated most of the process but struggling to get past reCaptcha for completing registration. Any help or guidance towards a solution would be greatly appreciated. Thanks in adva ...

The Selenium webdriver encountered difficulty in locating an element within a modal dialog

Having trouble finding buttons on dialog pages despite trying various methods like cssselectors and xpaths. I've included a screenshot of the code for reference. Any recommendations on how to locate these buttons/texts on modal dialogs? Thanks in a ...

Selenium PhantomJS: Opening Multiple Windows and Loading Pages Simultaneously

Is there a way to use selenium to open multiple web pages at once in separate windows? When using the get command in Selenium, it waits for the onload event before proceeding. However, I am looking for a method to start loading the page and continue witho ...

The current version of ChromeDriver is only compatible with Chrome version 99. However, the current browser version is at 98.0.4758

My current chrome version : 98.0.4758.102 I am currently using selenium version: 4.1.1, but I am unable to download chrome 99. My chrome 98 is up to date, so how can I obtain chrome 99 assuming it's a beta version? Trace log : ChromeDriver was start ...

Iterating through the keys of JSON objects in an Android app

I recently encountered an issue where I had to convert XML data to JSON programmatically. Here is a snippet of the XML structure: <channel> <title></title> <link>index.html</link> <description>...</description> &l ...

Error message: "Failed to initiate new process: ChromeDriverService"

Just two days ago I successfully used remDr<-remoteDriver(remoteServerAddr = "localhost", port=4444, browserName = "chrome") remDr$open() to open Chrome, navigate to a page, and login without any issues. However, when attempting the same process tod ...

Following drag-and-drop actions, there are occasions where Selenium in Python stubbornly remains in place

My program encounters occasional hanging after dragging and dropping elements, so I've implemented a timeout mechanism. Upon reaching the time limit, the first block of code runs successfully. However, the problem arises when driver.close() is suppose ...

Having trouble finding the button

<table id="charitiesToAdd" style="width: 100%;"> <div id="newProject000" style="padding-left: 10px; padding-top: 10px;"> <div id="newProject1" class="row row1" style="padding-left: 10px; padding-top: 10px; clear: both;"> <div class="l ...

Ways to discover the present date and transition to the following date?

Currently, I am encountering an issue with my automation script. My script utilizes the selenium tool along with Java language. The specific problem I am facing involves the need to view the current date after clicking on a calendar and verifying if a flig ...

Capacitor: Building without push-notifications plugin is not possible

I have been attempting to utilize the capacitor push notifications plugin in a quasar project. I followed this tutorial as a guide. However, upon running the command: quasar build -m capacitor -T android, I encountered this error within my quasar project: ...

Is Threading Suitable for a For Loop in Python?

Hello everyone, I am new to this platform and would like to seek help with a coding issue that I am facing. I have a for loop that I want to execute using threading. Here's an example: for i in range(0,100): print(i) I want to use 4-5 threads ...

I encountered an error when trying to locate an element using its class name and xpath in Selenium with Python. The error message displayed was `ERR_SSL_VERSION_OR_CIPHER_MISMATCH`

I am in need of gathering information from a specific webpage that cannot be referenced openly due to its adult content. In order to proceed further, I must first click the age confirmation button on the page. My sole interest is to retrieve the page' ...

Locate element using value in Selenium with Python

Currently, I am utilizing Selenium in conjunction with Python to autonomously extract data from various power plants. One challenge I am facing is the need to click on an element within each plant's unique interface. The difficulty lies in the fact th ...

Having trouble parsing a JSON Array containing sub arrays and objects

I am facing an issue with parsing the JSON data. I have tried accessing the JSON array in my MainActivity code, but unfortunately, I am unable to retrieve the details from the first element. Even after logging the arrayList returned from postExecute, it st ...

Exploring the contrast between the JsonWireProtocol mechanisms and the latest standards outlined in the W3C Living Document in the context of

Curious about the distinctions between the functionalities of JsonWireProtocol (now considered OBSOLETE) and the latest W3C Living Document dated 31 December 2019 (the updated standard) when utilizing Selenium for conducting UI tests. The process of initia ...

Utilize the power of -selenium, -python, and -xpath to extract the information within the

Attempting to access the content of certain tags on a website. Unfortunately, accessing them has proven to be difficult. Below are snippets of code: from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common ...

dissecting the code with xpath

While working on a website project, I encountered an issue with transferring selenium html to junit. Despite breaking down the code to its simplest form in firebug, I kept receiving an error stating "Element not found." It's possible that there is a s ...

How to Locate an Element by its ID using Selenium, without using Xpath, which is nested inside another

I am currently working on a small automation project. The website I'm dealing with has an unconventional design where multiple elements share the same id. Surprisingly, this hasn't caused any issues in the functionality of the website. However, i ...