0
votes

I'm using Seetest Automation from experitest.com, more accurately I'm using the MobileWebDriver implementation of Seetest Automation, as experitest says "...for mobile browsers [...] it can be used also to automate Native Applications as well".

So, I launch my instrumented app under Seetest, then open the inspector 'object spy'. This inspector is pretty cool because you can click in some screen element of the app and the inspector will automatically show the node in the DOM with all its properties. The inspector can validate xpath expressions of your screen DOM, so you can easily verify if you xpath expression is correct for the element your are looking for.

I have got a xpath: //*[@text='Login']

That xpath has been validated with the object spy, and it is able to locate the element I'm looking for.

So, I have a validated the xpath expression for my button, below is the Seetest client that will perform the click:

MobileWebDriver driver = new MobileWebDriver("localhost", 8889);
driver.client.setDevice(mydevice.ID);
// Launch instrumented app
driver.client.launch(myapp.activity, true, true); 

driver.findElementByXPath("//*[@text='Login']").click();

The four previous lines aren't working right. ¿Something wrong? ¿Missing something? ¿Instrumented vs. not instrumented?

Exception of previous four lines:

com.experitest.client.InternalException: Exception caught while executing click: Element was not identified: 'xpath=//*[@text='Login']' at zone NATIVE

I'm using Seetest's MobileWebDriver implementation because I need compatibility/integration with some selenium/appium code.

Thanks and hope someone knows something!

1

1 Answers

0
votes

The problem was the target 'zone' or 'context' to find the element. MobileWebDriver uses NATIVE zone as default. My application is an hybrid one that uses web components too, and the element that I was looking for is a web element.

So, the solution was use this method of MobileWebDriver:

((MobileWebDriver) driver).useWebIdentification();

That allows the driver to look into the WEB zone instead NATIVE.

There exists another method to check elements in NATIVE as well:

((MobileWebDriver) driver).useNativeIdentification();

Simple solution. Hope it helps.