How to Switch from application to Setting Screen ios application

I want to select Wifi from Setting Screen.
In my application when I click on the button to connect access point ,Setting screen is opened and when I select the wifi access point using accessibility id then Exception of No Such element is generated.

So can any one help me how to handle the driver between my application and setting screen.

1 Like

Can you provide screenshot of the inspector on that element and the code you using?

Hi @Telmo_Cardoso,

Thanks for reply

I am just clicking on the button “Open Setting” in iOS Application and default Wifi setting Screen of iOS is opened which contain list of wifi connection.

After that,
I click on the below element using

xpath : //XCUIElementTypeStaticText[@name=“AccessPointName”]
driver.findElement(By.xpath("//XCUIElementTypeStaticText[@name=“AccessPointName”]")).click()

or

accessibility Id = AccessPointName
driver.findElementByAccessibilityId(“accessPointId”);

but it shows the No Such Element Exception.

I am using iOSInspector.html to find id.

Can I use accessibility Id for to Select Wifi connection on Setting Screen?

how to handle the driver between my application and default iOS Setting Application?

That should work… can you share a screenshot of the inspector viewing those elements?

There is no need to Switching from my application to Setting Screen and It should work with accessibility id of element right?

Is there any other inspector for inspection of element in iOS .

Appium Inspector is not working with my real device .

It should work… please, post your code with appium logs with error.

You using any wait mechanism when locating elements?

@Telmo_Cardoso Is switching between different native apps supported in appium? I thought it was a not supported[Read somewhere for uiautomation. Not sure about xcuitest]. At-least not between two native applications. If it is between a native and web, yeah it is fine. Please let me know if i am wrong here. I too have many scenarios like this.

U can get the page source to see the elements.

For uiautomation I was not possible, but for xcuitest I can navigate to other apps and automate (not switch).

1 Like

Please find the logs of appium server

sing":“accessibility id”,“value”:“EcoNet-DC85DEB14184”}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: [“accessibility id”,“EcoNet-DC85DEB14184”,“6963af98-7f5e-49da-a5d5-10f220ea94d3”]
[debug] [XCUITest] Executing command ‘findElement’
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/4E9C5BE5-DDF2-4245-87AF-A855FC297751/element] with body: {“using”:“accessibility id”,“value”:“EcoNet-DC85DEB14184”}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:{“using”:“accessibility id”,“value”:“EcoNet-DC85DEB14184”,“description”:“unable to find an element”},“sessionId”:“4E9C5BE5-DDF2-4245-87AF-A855FC297751”,“status”:7}
[HTTP] <-- POST /wd/hub/session/6963af98-7f5e-49da-a5d5-10f220ea94d3/element 500

I have tried with different api.

accessPointNameAccessId = EcoNet-DC85DEB14184

  1. driver.findElementByAccessibilityId(locatorIOS.getProperty(“accessPointNameAccessId”));

TouchAction action = new TouchAction(driver);
action.tap(driver.findElementByAccessibilityId(locatorIOS.getProperty(“accessPointNameAccessId”)));
action.perform();
action.release();

driver.tap(1,driver.findElementByAccessibilityId(locatorIOS.getProperty(“accessPointNameAccessId”)),1);

I just tested same query on same page and it works properly for me. You have no wait, so make sure you are on the page you want before doing the query.

Have you trying debugging with IDE? And if nothing appears, check whats being returned in driver.getPageSource()

It’s still not working with Wait Statement.

I have used below API.

Tried with different xpath:
txtAccessPoint = //XCUIElementTypeStaticText[contains(@name=“EcoNet-DC85DEB14184”)]
txtAccessPoint = //XCUIElementTypeCell[contains(@label, ‘EcoNet-DC85DEB14184’)]
txtAccessPoint = //XCUIElementTypeCell[contains(@label, “EcoNet-DC85DEB14184”)]

TestBaseUtility.waiForVisibility(locatorIOS.getProperty(“txtAccessPoint”));
TouchAction action = new TouchAction(driver);
action.tap(driver.findElementByAccessibilityId(locatorIOS.getProperty(“accessPointNameAccessId”)));
action.perform();
action.release();

public static void waiForVisibility(String xpath) {
    wait = new WebDriverWait(driver, 30);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpath)));
}

Can you please tell me which version of appium are you using ?

can you please help me by providing exact XPATH which you are using.

Below is my page source code.

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















































































<XCUIElementTypeOther type=“XCUIElementTypeOther” value=“SSID” name="3 of 3

Please find attached file which contains the logs of appium server.

I am working in debugging mode and while waiting for visibilility of element it is showing the error.debugLogAppium.txt (25.5 KB)

Hi @Telmo_Cardoso,

Can you please tell me , Which Xpath or id are you using?

I want to try with that XPATH or id.

I just used your driver.findElementByAccessibilityId… didn’t had time to look at your logs… if you think its a bug open issue with ALL information in https://github.com/appium/appium/issues

Hi @Telmo_Cardoso,

Which version of appium,xcode and iOS are you using?