Please anyone suggest me how to read ui elements of hybrid app

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 32.78 sec <<< FAILURE! - in TestSuite
test_0001_loginTest on test_0001_loginTest(com.forktech.kyc_test_cases.Select_Test)(com.forktech.kyc_test_cases.Select_Test) Time elapsed: 31.704 sec <<< FAILURE!
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:“id”,“selector”:“check_doc_button”}
(Session info: webview=39.0.0.0)
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 131 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘2.46.0’, revision: ‘61506a4624b13675f24581e453592342b7485d71’, time: ‘2015-06-04 10:22:50’
System info: host: ‘DESKTOP-I8BK112’, ip: ‘192.168.11.2’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_121’
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=39.0.0.0, platform=ANDROID, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 6d388d91-1104-4acf-9585-925ff7d760d4
*** Element info: {Using=id, value=check_doc_button}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:27)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:358)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:399)
at io.appium.java_client.DefaultGenericMobileDriver.findElementById(DefaultGenericMobileDriver.java:47)
at io.appium.java_client.AppiumDriver.findElementById(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementById(AndroidDriver.java:1)
at org.openqa.selenium.By$ById.findElement(By.java:215)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:350)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at com.forktech.kyc_test_cases.Select_Test.test_0001_loginTest(Select_Test.java:113)

Results :

Failed tests:
Select_Test.test_0001_loginTest:113 » NoSuchElement no such element: Unable to…

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.757 s
[INFO] Finished at: 2017-03-17T12:17:48+05:30
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project kyc_tesing: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Lenovo\workspace\KYC_APPIUM_TESTING\kyc_test_cases\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@chaithra :

From reading what you specifically want to mention . To locate the element of Hybrid app you can use:

  1. UILocater, Appium for Android
  2. Appium , Xcode for ios .

Please specify in detail regarding your query

the driver is not taking tags id’s . For almost id’s it’s giving no such element exception

@chaithra :
Make sure you have instance of Android driver instead of remote webdriver
Because i am also doing hybrid app automation for ios 10+ . And I am able to inspect elements well with appium. All elements I am able to inspect with name with ios driver .From your logs it looks like you have switched to webview .

Means in hybrid app,in order to view the web view we have to switch the context to web view right??
I am using Android driver only

In each test case i am switching the context to web view only then also not able to retrieve the ui elements

@chaithra,
Yes you have to switch to webview. To confirm whether the web view is correctly can you please print the current URl with some sleep

it’'s in webview only

UI automator is also not taking der id’s

please any one reply

How to get the id of capture button to click on the same of camera in hybrid app’s appium testing

Please anyone reply i am not getting any documentation for this

Hi ,
Please anyone suggest me how to click on OK button of alerts in hybrid app appium testing??
thanks,
chaithra