Skip to main content

SeeTestAutomation- Using Mobile Listeners In C#

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

Description

This feature allows to handle an unexpected UI interrupts without compromising the test execution speed.

Once a MobileListener is registered, it would be notified about any relevant event and an action may be taken by the client.

Parameters

  • Type: method of detecting the element

  • Element: element to detect

  • MobileListener: mobile listener object

Return value:

Whether recovered or not.

  • true 

  • false

Adding listener example:

// in case of incoming call during a test the call will be rejected and will
// not affect the test

client.addMobileListener("NATIVE", "xpath=//*[@text='Incoming call']", new MyMobileListener(client));

Removing listener example (calling without the last parameter and disabling the mobile listeneter ):

client.addMobileListener("NATIVE", "xpath=//*[@text='Incoming call']");

Mobile Listener implementation example:

using experitestClient;  
class MyMobileListener : MobileListener

{

public MyMobileListener(Client client) : base(client) { }

public override bool recover(String type, String xpath)
{
     try
{
// Add your code here

 client.click("NATIVE", "xpath=//*[@text='Decline']", 0, 1);
            return true;
}
catch (Exception)
{
return false;
}
return true;
}
}