I am testing an iOS application (on a real device) and encountering the following error:
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: AUT is not installed. (WARNING: The server did not provide any stacktrace information).
It would be helpful if someone could point out why the Selenium is throwing this error. I am able to manually connect to the UFT Mobile device and it works fine.
My code is:
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.IOSMobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;
// extends BaseTest_MobileScripts
public class AppTest {
public static IOSDriver<IOSElement> appDriver;
public static DesiredCapabilities capabilities;
@BeforeSuite
public void setupAppium() throws MalformedURLException {
capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone X");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "13.7");
capabilities.setCapability("userName", "username");
capabilities.setCapability("password", "password");
capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "abc.def.geh");
appDriver = new IOSDriver<IOSElement>(new URL("http://127.0.0.1:8443/wd/hub"), capabilities);
appDriver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
appDriver.resetApp();
}
@AfterTest
private static void afterTest() {
appDriver.resetApp(); // Clear all the application data and permissions.
appDriver.quit(); // End Appium session.
}
@Test (enabled=true) public void myFirstTest() throws InterruptedException {
appDriver.resetApp();
}
}
The partial stacktrace is attached here https://pastebin.com/npcDyz2a.
Advertisement
Answer
After so many tries, i finally got a solution that works to me!!
This error happens when a permision Pop-up (Like permission to acess cam or storage) is showed.
If you dont give the permission in with the automation, when a test fails and start the next, the pop-up dont disappear, and when Appium try to find your app, it can’t find, because the permission pop-up is overlapping your application.
Try to find which test need some permission and add a step to give this permission.
In my case, someone in project removes this step which gives the permission for camera, and because that, my CI Pipeline start to crash, when I went back this step to the code, this error stop to happen.