I am new appium javascript client, trying to access an element on android phone, It loaded apk on device and then showing “element not found erro”
I tried to get element using both xpath and id but no success, please have a look on mocha logs showing element is not find
Enviroment:
Android Phone(5.0)
appium 1.3.7
Please have a look on screenshot(uiautomatorviewer view showing element details) as well, plus guide me if I am missing somthing,
Try#1
Code:
return driver.
elementByXPath(‘//android.widget.TextView[@text='Verify settings']’)
.text()
.then(function (text) {
console.log(’ ', text);
});
TestCase
CALL init({“browserName”:“”,“appium-version”:“1.3”,“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“galaxy s6”,“app”:“/apps/app.apk”})
POST /session {“desiredCapabilities”:{“browserName”:“”,“appium-version”:“1.3”,“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“galaxy s6”,“app”:“/apps/app.apk”}}
Driving the web on session: 320499ca-377b-4308-a316-5fc58f6b5d17
RESPONSE init({“browserName”:“”,“appium-version”:“1.3”,“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“galaxy s6”,“app”:“/apps/app.apk”}) “320499ca-377b-4308-a316-5fc58f6b5d17”,null
CALL elementByXPath(“//android.widget.TextView”)
POST /session/:sessionID/element {“using”:“xpath”,“value”:“//android.widget.TextView”}
1) Should verify if frontdoor screen is loaded
CALL sleep(3000)
RESPONSE sleep(3000)
CALL quit()
DELETE /session/:sessionID
Ending your web drivage…
RESPONSE quit()
0 passing (19s)
1 failing
- TestCase Should verify if frontdoor screen is loaded:
Error: [elementByXPath(“//android.widget.TextView”)] Error response status: 7, , NoSuchElement - An element could not be located on the page using the given search parameters. Selenium error: An element could not be located on the page using the given search parameters.
at _stream_readable.js:908:16
Try#2
Code:
it(“Should verify if frontdoor screen is loaded”, function(){
return driver.
elementById(‘android:id/alertTitle’)
.text()
.then(function (text) {
console.log(’ ', text);
});
Logs:
TestCase
CALL init({“browserName”:“”,“appium-version”:“1.3”,“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“galaxy s6”,“app”:“/apps/app.apk”})
POST /session {“desiredCapabilities”:{“browserName”:“”,“appium-version”:“1.3”,“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“galaxy s6”,“app”:“/apps/app.apk”}}
Driving the web on session: ea2a3f2b-a6b0-439f-9f8b-3b5e6cefcc60
RESPONSE init({“browserName”:“”,“appium-version”:“1.3”,“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“galaxy s6”,“app”:“/apps/app.apk”}) “ea2a3f2b-a6b0-439f-9f8b-3b5e6cefcc60”,null
CALL elementById(“android:id/alertTitle”)
POST /session/:sessionID/element {“using”:“id”,“value”:“android:id/alertTitle”}
1) Should verify if frontdoor screen is loaded
CALL sleep(3000)
RESPONSE sleep(3000)
CALL quit()
DELETE /session/:sessionID
Ending your web drivage…
RESPONSE quit()
0 passing (19s)
1 failing
- TestCase Should verify if frontdoor screen is loaded:
Error: [elementById(“android:id/alertTitle”)] Error response status: 7, , NoSuchElement - An element could not be located on the page using the given search parameters. Selenium error: An element could not be located on the page using the given search parameters.
at _stream_readable.js:908:16