Object spy couldn't recognize elements(chart) inside - XCUIElementTypeOther

I’m trying to locate a chart inside XCUIElementTypeOther, but the object spy couldn’t recognize… Here is the screenshot

Any work around for this?

Hi

Can you try to instrument the application

add the capability
dc.setCapability(“instrumentApp”,true)

OR
use the instrument checkbox from the Appium Studio UI

then open the dump and see if you have more details

@Tom

I instrumented the application, still i couldn’t locate the element present inside the chart.

@Tom

Any workaround for this?

Argh! there is one more option left, but it’s not an easy one to master

I need you to describe the actions that you want to perform against the element

We might have a way to interact with it natively, but we will be limited as it won’t be via UI

Step 1 -

Right click on the element from the object spy and choose API Call

Step 2 -

In the dialog that opens up, search for your action (e.g getDate \ setDate)

If you find the action you are looking for, click on test - try to send appropriate values

ping me once you get to this point…

@Tom
That’s not an API

You need to work in an instrumented mode

Hey Tom,

Yes, i reached to this point. I got the intended result in the result section

So How can i use these values in asserting my test?

Hi Raghu,

This looks great

Now you could invoke that API Call directly from your script

e.g :

String result = driver.executeScript("client:client.runNativeAPICall('view.getBarData().getDataSets()");

and analyze the results

let us know how if you have any issues

Tom

The TestNG stacktrace prints - org.openqa.selenium.WebDriverException: javascript error (javascript error. TypeError: Can not invoke method [jdk.internal.dynalink.beans.SimpleDynamicMethod Map com.experitest.image.agent.appium.backend.commands.browser.AppiumScriptClient.runNativeAPICall(String,String,int,String)] with the passed arguments; they do not match any of its method signatures. in

I forgot one bracket (’) at the end of the phrase

String result = driver.executeScript(“client:client.runNativeAPICall('view.getBarData().getDataSets()'”);

Tom,

Now I’m getting webDriver exception for the script -

driver.executeScript(“client.runNativeAPICall(“NATIVE”, “xpath=//*[@id=‘chart1’]”, 0, ‘view.getBarData().getDataSets();’)”);

org.openqa.selenium.WebDriverException: unknown error (An unknown server-side error occurred. status=‘false’. Failed to complete internal method: ‘hybridRunJavascript args: [, 0, client.runNativeAPICall(“NATIVE”, “xpath=//*[@id=‘chart1’]”, 0, ‘view.getBarData().getDataSets();’)]’, details: Failed to run javascript ‘’: null) (WARNING: The server did not provide any stacktrace information)

you forgot the client: prefix

driver.executeScript("client:client.runNativeAPICall(\"NATIVE\", \"xpath=//*[@id='chart1']\", 0, 'view.getBarData().getDataSets();')");