How do i close an application in ios

I have scenario, where i open the settings application in ios, do some changes , and then run my tests on my company software.

For the second test case , i need to open the settings again in default view. So that i can do some other changes to it.

Is it possible to kill /close the settings application?

try:
driver.executeScript(“client:client.applicationClose(“myapppackage”)”);

@guy I have considered it as a webelement, where i click on settings . For eg:xpath = WebElement iphoneSettings “//*[@text=‘Settings’]”, and then used iphoneSettings.click

If you would like to close the settings app:
driver.executeScript(“client:client.applicationClose(“com.apple.Preferences”);”);

@guy I tried the same thing as you mentioned above

" @FindBy(xpath = “//*[@text=‘Settings’]”)
public WebElement iphoneSettings;
getDriver().deviceAction(“Home”);
iphoneSettings.click();
// then i have some extra code here//

getdriver().executeScript(“client:client.applicationClose(“com.apple.Preferences”)”);

This does not seem to close the settings.

which version of driver are you using?

it looks like you are using an older version than what we support

can you share the entire code or an example of what you are trying to execute?

@Tom

Do you mean the experitest selenium driver? If yes, then its version 2.53.1

I have written the xpath of the webelements initially itself.

      log.info("Clicking the Home button in iphone");
        getDriver().deviceAction("Home");
        log.info("Clicking the Settings button in iphone");
        iphoneSettings.click();
        log.info("swipe to get the search field");
        getDriver().swipe(381, 284, 329, 719, 369);
        log.info("Entering in the search field");
        settingsSearch.sendKeys("xxxxapp namexxxx");
        log.info("Click on the result of app name");
        appname.click();
        log.info("Click on Environment");
        environSelect.click();
       getDriver().executeScript("client:client.applicationClose(\"com.apple.Preferences\")");
       getDriver().launchApp("xxxxxapp bundle idxxxxxx");

Any updates on this issue i am facing?

Hi Nisha

We’ve depracted experitest dependencies

You should use standard AppiumDriver 4.1.2
https://docs.experitest.com/display/public/TD/Updating+Appium+Studio+from+10.8+to+10.9+and+Higher
https://mvnrepository.com/artifact/io.appium/java-client/4.1.2

@Tom

<?xml version="1.0" encoding="UTF-8"?>


4.0.0

<groupId>com.XXXX.app.XXXX</groupId>
<artifactId>XXXApp</artifactId>
<version>1.0-SNAPSHOT</version>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.0</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19</version>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.5</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-picocontainer -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.experitest</groupId>
        <artifactId>seetest-appium</artifactId>
        <version>10.8</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
</dependencies>

i am using the java client 4.12 already. Or am i doing something wrong. This is the POM file i use. And also in the link provided it mentions “Change SeeTestAndroidDriver/SeeTestIOSDriver to AndroidDriver/IOSDriver” . But if i try to use “driver = new IOSDriver(new URL(“http://127.0.0.1:4723”), capabilities);” it gives me an error.