2

enter image description hereI am getting error message while running the python code with Android 4.1.2 (API level 16)

This is my python code :

import os
from time import sleep

import unittest
import time
from appium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


class MaverickAndroidTests(unittest.TestCase):
#API level less than 17

def setUp(self):
            "Setup for the test"
    desired_caps = {}
            desired_caps['automationName']='Selendroid'
    desired_caps['browserName']=''
    desired_caps['platformName'] = 'Android'
    desired_caps['platformVersion'] = '4.1.2'
    desired_caps['deviceName'] = 'karthikphone1'
    # Returns abs path relative to this file and not cwd
    desired_caps['app'] = '/home/karthik/appiumworkspace/tests/app-debug (4).apk'
    desired_caps['appPackage'] = 'com.prueba.maverick'
    desired_caps['app-activity'] = '.SplashActivity'  #Prueba logo
    desired_caps['app-wait-activity'] = '.MainActivity' 
    self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

def tearDown(self):
            "Tear down the test"
            self.driver.quit()

def test_record_the_audio(self):
            "Test it clicks on Record button correctly" 
        element = WebDriverWait(self.driver, 30).until(EC.presence_of_element_located((By.NAME, "PRESS TO RECORD")))
        element.click()
        time.sleep(4)   
        element = WebDriverWait(self.driver, 30).until(EC.presence_of_element_located((By.NAME, "RECORDING PRESS TO STOP")))
        element.click()
        #strings = self.driver.app_strings()
        #print(strings)
        print(' ')
        print('AUDIO RECORDED SUCCESSFULLY')    

#---START OF SCRIPT
if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(MaverickAndroidTests)
    unittest.TextTestRunner(verbosity=2).run(suite)

This is what I get in Appium : Earlier I had got this error message apk does not have INTERNET permissions. Selendroid needs internet permission to proceed

Now I am getting this.. I don't know what is wrong in my code.

    info: [debug] Using local app from desired caps: /home/karthik/appiumworkspace/tests/app-debug (4).apk
    info: [debug] Creating new appium session 35f5bbe7-3abc-4b3a-bf29-f46542d36cae
    info: [debug] Starting selendroid server
    info: [debug] Getting Java version
    info: Java version is: 1.7.0_95
    info: [debug] Checking whether adb is present
    info: [debug] Using adb from /home/karthik/selenium/android-sdk-linux/platform-tools/adb
    info: [debug] Checking whether selendroid is built yet
    info: [debug] Selendroid server exists!
    info: [debug] Using fast reset? false
    info: [debug] Preparing device for session
    info: [debug] Checking whether app is actually present
    info: Retrieving device
    info: [debug] Trying to find a connected android device
    info: [debug] Getting connected devices...
    info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb devices
    info: [debug] 1 device(s) connected
    info: Found device d65d04425101de
    info: [debug] Setting device id to d65d04425101de
    info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
    info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de wait-for-device
    info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "echo 'ready'"
    info: [debug] Starting logcat capture
    info: [debug] Checking whether aapt is present
    info: [debug] Using aapt from /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/aapt
    info: [debug] Checking if has internet permission from manifest.
    info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/aapt dump badging "/home/karthik/appiumworkspace/tests/app-debug (4).apk"
    info: [debug] Parsing package and activity from app manifest
    info: [debug] Checking whether aapt is present
    info: [debug] Using aapt from /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/aapt
    info: [debug] Extracting package and launch activity from manifest.
    info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/aapt dump badging "/home/karthik/appiumworkspace/tests/app-debug (4).apk"
    info: [debug] badging package: com.prueba.maverick
    info: [debug] badging act: com.prueba.maverick.SplashActivity
    info: [debug] Parsed package and activity are: com.prueba.maverick/com.prueba.maverick.SplashActivity
    info: [debug] Rebuilt selendroid server already exists, no need to rebuild it with a new manifest
    info: [debug] Checking signed status of /tmp/selendroid.com.prueba.maverick.apk
    info: [debug] Checking app cert for /tmp/selendroid.com.prueba.maverick.apk.
    info: [debug] executing cmd: java -jar /home/karthik/.linuxbrew/lib/node_modules/appium/node_modules/appium-adb/jars/verify.jar /tmp/selendroid.com.prueba.maverick.apk
    info: [debug] Checking signed status of /home/karthik/appiumworkspace/tests/app-debug (4).apk
    info: [debug] Checking app cert for /home/karthik/appiumworkspace/tests/app-debug (4).apk.
    info: [debug] executing cmd: java -jar /home/karthik/.linuxbrew/lib/node_modules/appium/node_modules/appium-adb/jars/verify.jar "/home/karthik/appiumworkspace/tests/app-debug (4).apk"
info: [debug] App already signed.
info: [debug] Zip-aligning /tmp/selendroid.com.prueba.maverick.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/zipalign
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/zipalign -f 4 /tmp/selendroid.com.prueba.maverick.apk /tmp/11629-15005-19n6oqt/appium.tmp
info: [debug] App already signed.
info: [debug] Zip-aligning /home/karthik/appiumworkspace/tests/app-debug (4).apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/zipalign
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/zipalign -f 4 "/home/karthik/appiumworkspace/tests/app-debug (4).apk" /tmp/11629-15005-fq0478/appium.tmp
info: [debug] Rebuilt selendroid apk exists, doing nothing
info: [debug] Getting install status for com.prueba.maverick.selendroid
info: [debug] Getting device API level
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "getprop ro.build.version.sdk"
info: [debug] MD5 for selendroid server is a744df7307c76f3eb197e11e4b362ed2
info: [debug] Device is at API Level 16
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "pm list packages -3 com.prueba.maverick.selendroid"
info: [debug] App is installed
info: [debug] Rebuilt selendroid is already installed
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar "/home/karthik/.linuxbrew/lib/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/home/karthik/appiumworkspace/tests/app-debug (4).apk" "/tmp/com.prueba.maverick" en
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] No strings.xml for language 'en', getting default strings.xml
info: [debug] java -jar "/home/karthik/.linuxbrew/lib/node_modules/appium/node_modules/appium-adb/jars/appium_apk_tools.jar" "stringsFromApk" "/home/karthik/appiumworkspace/tests/app-debug (4).apk" "/tmp/com.prueba.maverick"
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for /home/karthik/appiumworkspace/tests/app-debug (4).apk.
info: [debug] executing cmd: java -jar /home/karthik/.linuxbrew/lib/node_modules/appium/node_modules/appium-adb/jars/verify.jar "/home/karthik/appiumworkspace/tests/app-debug (4).apk"
info: [debug] App already signed.
info: [debug] Zip-aligning /home/karthik/appiumworkspace/tests/app-debug (4).apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/zipalign
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/build-tools/23.0.2/zipalign -f 4 "/home/karthik/appiumworkspace/tests/app-debug (4).apk" /tmp/11629-15005-n183k/appium.tmp
info: [debug] MD5 for app is 852327714566a1d4b057669d587021d7
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "ls /data/local/tmp/852327714566a1d4b057669d587021d7.apk"
info: [debug] Getting install status for com.prueba.maverick
info: [debug] Getting device API level
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 16
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "pm list packages -3 com.prueba.maverick"
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "mkdir -p /data/local/tmp/"
info: [debug] Removing any old apks
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "ls /data/local/tmp/*.apk"
info: [debug] Found an apk we want to keep at /data/local/tmp/852327714566a1d4b057669d587021d7.apk
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell rm "/data/local/tmp/settings_apk-debug.apk" && rm "/data/local/tmp/unlock_apk-debug.apk"
info: [debug] Uninstalling com.prueba.maverick
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "am force-stop com.prueba.maverick"
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de uninstall com.prueba.maverick
info: [debug] App was not uninstalled, maybe it wasnt on device?
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "pm install -r /data/local/tmp/852327714566a1d4b057669d587021d7.apk"
info: [debug] Forwarding system:8080 to device:8080
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de forward tcp:8080 tcp:8080
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de install "/home/karthik/.linuxbrew/lib/node_modules/appium/build/settings_apk/settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de install "/home/karthik/.linuxbrew/lib/node_modules/appium/build/unlock_apk/unlock_apk-debug.apk"
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "am instrument -e main_activity 'com.prueba.maverick.SplashActivity' com.prueba.maverick.selendroid/io.selendroid.server.ServerInstrumentation"
info: [debug] [SELENDROID] (SystemEventReceiver, 46) android.intent.action.PACKAGE_ADDED
info: [debug] [SELENDROID] android.intent.action.PACKAGE_ADDED
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/status","method":"GET"}
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/status","method":"GET"}
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/status","method":"GET"}
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/status","method":"GET"}
info: [debug] Selendroid server is alive!
info: [debug] Listening for Selendroid logs
info: [debug] Creating Selendroid session
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session","method":"POST","json":{"desiredCapabilities":{"warnings":{},"desired":{"deviceName":"d65d04425101de","automationName":"Selendroid","browserName":"","platformVersion":"4.1.2","appPackage":"com.prueba.maverick","platformName":"Android","app":"/home/karthik/appiumworkspace/tests/app-debug (4).apk"},"deviceName":"d65d04425101de","automationName":"Selendroid","browserName":"","platformVersion":"4.1.2","appPackage":"com.prueba.maverick","platformName":"Android","app":"/home/karthik/appiumworkspace/tests/app-debug (4).apk"}}}
info: [debug] Successfully started selendroid session
info: [debug] Waiting for pkg "com.prueba.maverick" and activity "com.prueba.maverick.SplashActivity" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "dumpsys window windows"
info: [debug] Overriding session id with "9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId 9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae
info: <-- POST /wd/hub/session 303 37508.320 ms - 74 
info: --> GET /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae {}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","method":"GET"}
info: [debug] Proxied response received with status 200: {"value":{"automationName":"selendroid","platform":"android","app":"/home/karthik/appiumworkspace/tests/app-debug (4).apk","acceptSslCerts":true,"javascriptEnabled":true,"browserName":"selendroid","networkConnectionEnabled":true,"rotatable":true,"desired":{"automationName":"Selendroid","platformVersion":"4.1.2","app":"/home/karthik/appiumworkspace/tests/app-debug (4).apk","deviceName":"d65d04425101de","platformName":"Android","browserName":"","appPackage":"com.prueba.maverick"},"appPackage":"com.prueba.maverick","version":"0.17.0","platformVersion":"16","deviceName":"d65d04425101de","platformName":"android","handlesAlerts":true,"warnings":{},"takesScreenshot":true},"status":0,"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- GET /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae 200 62.098 ms - 736 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 46.050 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 34.196 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 31.257 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 33.714 ms - 201 
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 70.138 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 29.763 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 33.066 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 31.828 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 50.611 ms - 201 
info: --> POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element {"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}
info: [debug] Proxying command to localhost:8080
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element","method":"POST","json":{"using":"name","sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","value":"PRESS TO RECORD"}}
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Element was not found."},"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- POST /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae/element 500 77.062 ms - 201 
info: --> DELETE /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae {}
info: Shutting down appium session
info: [debug] Stopping selendroid server
info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae","method":"DELETE"}
info: [debug] executing cmd: /home/karthik/selenium/android-sdk-linux/platform-tools/adb -s d65d04425101de shell "am force-stop com.prueba.maverick"
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] [SELENDROID] setSystemUiVisibility(0x0)
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}
info: <-- DELETE /wd/hub/session/9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae 200 1874.112 ms - 76 {"status":0,"value":null,"sessionId":"9d0c6d37-a0b8-bd9c-78d4-e6af53e687ae"}

Python output :

karthik@dkarnik2-Vostro-3558:~/appiumworkspace/appium-1.4.13/submodules/sample-code/examples/python$ python maverick.test.in.mobile.using.appium.py
test_record_the_audio (__main__.MaverickAndroidTests)
Test it clicks on Record button correctly ... ERROR

======================================================================
ERROR: test_record_the_audio (__main__.MaverickAndroidTests)
Test it clicks on Record button correctly
----------------------------------------------------------------------
Traceback (most recent call last):
  File "maverick.test.in.mobile.using.appium.py", line 67, in test_record_the_audio
    element = WebDriverWait(self.driver, 30).until(EC.presence_of_element_located((By.NAME, "PRESS TO RECORD")))
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
TimeoutException: Message: 


----------------------------------------------------------------------
Ran 1 test in 53.124s

FAILED (errors=1)
Community
  • 1
  • 1
Karthik
  • 315
  • 1
  • 4
  • 16
  • An element could not be located on the page using the given search parameters.","origValue":"Element was not found." --> Selendroid server couldn't find element with name=PRESS TO RECORD, can you check this element in UIAutomatorViewer, you need to send the correct search parameters !! – Pankaj Kumar Katiyar Mar 09 '16 at 10:11
  • The same code works fine when I run it with physical device, whose API level is 19. But, When I run with the physical device, with API level 16 using selendroid, I am getting this error.. So, I don't think the `search parameters` is incorrect. – Karthik Mar 09 '16 at 10:29
  • Yeah, I have checked UIAutomatorViewer.. Element text is - `PRESS TO RECORD` – Karthik Mar 09 '16 at 10:31
  • Can you try with xpath rather than using name. – Pankaj Kumar Katiyar Mar 09 '16 at 11:01
  • haven't used the python client this much, but could you throw some light on `EC.presence_of_element_located((By.NAME, "PRESS TO RECORD"))` – Naman Mar 09 '16 at 15:12
  • I will give it a try now and come back to you.. @PankajKatiyar – Karthik Mar 10 '16 at 03:06
  • `EC.presence_of_element_located((By.NAME, "PRESS TO RECORD"))` Here EC is ExpectedCondition.. A successful return for ExpectedCondition type - Boolean return true or not null return value for all other ExpectedCondition types.. @nullpointer Here, I am checking, if the button with the name "PRESS TO RECORD" is present or not.. If it is present, it has to click on it.. – Karthik Mar 10 '16 at 03:18
  • @nullpointer I tried all these.. But nothing worked... :( 1 `element = self.driver.find_element_by_xpath("//android.widget.Button[@text='PRESS TO RECORD']")` 2 `self.driver.find_element_by_xpath("//android.widget.Button[contains(@text='PRESS TO RECORD')]").click()` 3 `element = WebDriverWait(self.driver, 30).until(EC.presence_of_element_located((By.NAME, "PRESS TO RECORD")))` 4 `element = self.driver.find_element_by_xpath("//android.widget.Button[@text='PRESS TO RECORD' and @index='0']")` 5 `element = self.driver.find_element_by_class_name("android.widget.Button[@index='0']")` – Karthik Mar 10 '16 at 05:09
  • @nullpointer I have included screenshot in my question.. – Karthik Mar 10 '16 at 05:21
  • @PankajKatiyar check the screenshot above.. – Karthik Mar 10 '16 at 05:21
  • Did you try using explicit wait until element is visible or clickable ??? – Pankaj Kumar Katiyar Mar 10 '16 at 05:37
  • Yes.. The above code has explicit wait in it.. If you have noticed.. – Karthik Mar 10 '16 at 06:13
  • Guys.. I need help on this too.. http://stackoverflow.com/questions/35884580/functional-test-of-an-android-app-using-appium-and-python I am doing it using Android 4.4.2... – Karthik Mar 10 '16 at 10:51
  • tldr; couldn't understand the question – Naman Mar 10 '16 at 18:01
  • The code displayed in the question http://stackoverflow.com/q/35884580/5887785 is to record an audio.. It stores in a folder called `Maverick` within the physical device (internal storage).. Now, I need to check whether the recording which has been recorded is actually present in that location or not.. recordings are uniquely named during recording like `recording1`, `recording2`, etc... I just want to know, how can I go to `File Manager` or `My Files` in my phone, through code and verify the recording.. – Karthik Mar 11 '16 at 03:31

0 Answers0