App is not closing during appium session in Simulator - ios

Failed to close app in simulator at the time of mobile test execution
Tried driver.closeApp() command . Also tried exit with code Zero.

While Appium Session is running a default capability is passed in logs.
check in logs shouldTerminatApp if it is false.
In the base class mention the following:
DesiredCapabilities dc= new DesiredCapabilities();
dc.dc.setCapability("shouldTerminateApp",true);

Related

Unable to run WebDriverAgent on the real device using Appium Desktop

I am unable to run WebDriverAgent on a real device using Appium Desktop. I have attached gist for the error log.
I have tried some solution from github/appium but it did not solve my issue.
server log
https://gist.github.com/guowang94/ec923da6a3b77aca06a902c450200238
appium.app error message
https://gist.github.com/guowang94/ef2c5bb5bcc617baa2af19418e9a8b8e
I expect the WebDriverAgent to be running in the real device so that I can proceed to my next task but I am unable to install and run WebDriverAgent on the real device
Your logs have both the problem:
An empty identity is not valid when signing a binary for the product type 'UI Testing Bundle'. (in target 'WebDriverAgentRunner')
which indicates incorrect XCode configuration with regards to signing the WebDriverAgentRunner-Runner.app
and the solution:
Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65 .... Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md
If the official guide is not clear you can follow steps from the Configuring Appium Environment for iOS Real Device article.
You can also consider Appium Studio which makes the process of setting up Appium testing on real iOS devices much easier.

is 'APP' capability REQUIRED for WDA installation?

I'm trying to run an appium script with a real iOS device. I am currently getting this error:
Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Apparently this error is associated with security issues at noted here, but I've already completed that step and it's still not working. So then I thought maybe this is b/c my appium script does NOT set the 'APP' capability. 'APP' capability is of course is the full path to the application that is under test. The appium documentation here obviously doesn't indicate which settings are required if any. My question is will the Webdriver Agent not get installed on the device if the 'APP' capability is not set and thus throwing the error above?
You can right-click on the appium app (which is in ur application folder) you are using > show package contents > search for .xcodeproj > you will see a couple of projects including web driver. Now open web driver agent Xcode project and use an apple developer account to code sign it.
If you have already done this, then please update your question with appium capabilities that you have set.

Unable to launch app on IOS Simulator - WebDriver Agent error

I have installed Appium and XCode and am trying to launch an app on the simulator. The app works when I open the simulator manually and click on the app.
My capabilities look as follows:
File app = new File ("/Users/me/Desktop/myapp.app");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("deviceName", "iPhone 8");
capabilities.setCapability("automationName", "XCUITest");
capabilities.setCapability("app", app.getAbsolutePath());
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
The error I get is:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: "Command 'Scripts/bootstrap.sh -d' exited with code 1". (WARNING: The server did not provide any stacktrace information)
I followed the instructions given in the answer to this question:
Unable to launch ipa file in IOS 10 real Device using appium 1.6.0
When I build the WebDriverAgent through XCode, it builds without any problems, but as soon as I try to launch through IntelliJ or Appium Desktop, it gives me that error.
So I eventually managed to get it working, here are some of the errors that I encountered and how I fixed them:
Unable to launch WebDriverAgent because of xcodebuild failure: "Command 'Scripts/bootstrap.sh -d' exited with code 1
Solution: looking at the Appium server log, I noticed that it was unable to write to a directory. The problem was that my Appium app was sitting in Downloads. Once I moved it to Applications, this problem was fixed.
XCode build failed with exit code 65
Solution: the problem here was with my Provisioning Profiles (I opened the app in XCode and went to the General tab to see these).
I had created a personal apple account, but I didn't have the certificates needed to run the app. I had to get one of our iOS developers to invite me to their team, downloaded certificates and then ticked the "Automatically manage signing" check box -- there were a couple of other steps with the certificates that I can't remember.
It was connecting to the simulator, it launched WebDriverManager, but then wouldn't launch my app (it just hung).
Solution: I had made a mistake in my capabilities, I had it set as:
capabilities.setCapability("bundleId", "com.facebook.WebDriverAgentLib");
Which was the bundleID for WebDriverAgent, I updated it with the bundleID for my app:
capabilities.setCapability("bundleId", "myapp");
(Bundle ID can be found by going to the app in finder, right clicking and selecting "Show Package Contents". Open the "Info.plist" file and there you'll find the Bundle ID for the app.

Trying to run Appium test in android 7.0, but just Appium settings and Unlocker app get installed and test does not run

Following is the link to my code and error sin appium console
and eclipse console:
Link to the code and error in eclipse console and appium console
If you check the Appium logs, it has this line in there -
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
This means that version is not the correct property name. You have to change it to platformVersion. Try changing it and see it it works. The line of code would be like this -
capabilities.setCapability("platformVersion", "7.0");
Also, there is no need to provide the browser name, as you are not using it anywhere. But that shouldn't affect the test script execution in any way.
You can also check this article which shows the capabilities you can use to launch an app - Appium Script to Launch App

Instrument crash at startup appium

Am trying to run appium tool for testing apps. While starting appium server i finished all setting right way. When appium running the app will start at time but suddently it get crash.
Yes.Am using Xcode 6.0 and Appium 1.3.4
Make sure the .app file you are using is build for simulator if you are running appium for simulator and a different build i.e the build for device if you want to run it into real device....This is one of the cause which causes the instruments to crash at start up.
When I create an new project with XCode then generate the app file, it is working fine - I can open the inspector.
But I have a problem when I use an already developed application and the build is coming from a developer profile : I can't open the inspector and instruments crash on startup.
While running the script please start xcode and go in the settings of the mobile device and find developer options. Make sure UIAutomation is enabled there. If it is not then enable it and after it try to run the script again. Surely it will work.

Resources