Follow the below steps to execute Appium scripts on Perfecto.

Step 1:

Below are the properties that we need to set in file










appName = Contact Manager

Step 2:

Create Webdriver listener. Create or update onInitialize method, to launch application when driver initialized.

public class PerfectoDriverListener extends QAFWebDriverCommandAdapter {

    public void onInitialize(QAFExtendedWebDriver driver) {
        String appName = ConfigurationManager.getBundle().getString("appName");
        //Close Application if already its opened
        String command = "mobile:application:close";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("name", appName);
        try {
            ((RemoteWebDriver) driver.getUnderLayingDriver())
                    .executeScript(command, params);
        } catch (Exception e) {
            System.err.println("Unable to close app: " + appName);

        //Open Application
        command = "mobile:application:open";
        ((RemoteWebDriver) driver.getUnderLayingDriver()).executeScript(
                command, params);
        //Switch Context
        RemoteExecuteMethod executeMethod = new RemoteExecuteMethod(
                (RemoteWebDriver) driver.getUnderLayingDriver());
        executeMethod.execute(DriverCommand.SWITCH_TO_CONTEXT, params);


Step 4:

Registering listener

To register listener set property “wd.command.listeners”.

For example to register above created listener you need to set property as below: