Hi guys,
I am going to write about “How you can install the framework of safari to run appium tests”. If you need run tests in safari of real devices with Appium, you can use this framework for ios devices (Android it is more easier as always). So, you need to have an apple developer account.
-> Plug your device
-> Git clone this project: https://github.com/budhash/SafariLauncher
-> Add your device in your developer apple register.
https://developer.apple.com/account/ios/device/deviceList.action
-> Download your certificate and your mobile provisioning profile after
https://developer.apple.com/account/ios/certificate/certificateList.action
&
https://developer.apple.com/account/ios/profile/profileList.action
-> Install your mobile provision in your device (or double touch on the file)
-> Put in blundle id com.safariLauncher.safariLauncher -> inside of the general properties of the project
-> Check if you are deploying in the right version of ios.
-> Run the project
-> Don’t forget to set the capabilities in your automation project:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.3.1");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("deviceName", "Tahir's iPhone");
capabilities.setCapability("udid", "your_udid");
capabilities.setCapability("bundleId", bundle);
capabilities.setCapability("browserName", "safari");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.get("http://www.google.com");
Thread.sleep(20000);
Once you have deployed the safari launcher to the device, everything should be configured correctly so that the next time you run ./reset.sh on appium, the installation of the safari launcher app should succeed.
See you next week !
Why should you use an Apple dev account for testing iOs apps? There are ways to test without a Apple dev-account.
Hi Osman, Anything you want to do at device level either native/hybrid/mobileweb testing you should be part of dev program either as individual or enterprise level. Refer this
http://mobiforge.com/design-development/deploying-iphone-apps-real-devices
Do you not need to specify an app path when running against a physical device? e.g.
cap.setCapability(“app”, “/Users/mobilelabmac/Library/Developer/Xcode/DerivedData/…”)
Hi William, I found this: Appium will attempt to install this app binary on the appropriate device first. Note that this capability is not required for Android if you specify appPackage and appActivity capabilities
So, seems there is not need to specify any app argument in desired capabilities if you are passing UDID and Bundle ID from Appium.app. But I found some people saying that they had to build the app before with Xcode and others saying that you need set the ipa or the path to run in real devices.
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(CapabilityType.BROWSER_NAME, CONFIG_PROPERTIES.getProperty(“browser_name”));
desiredCapabilities.setCapability(CapabilityType.VERSION, CONFIG_PROPERTIES.getProperty(“ios_simulator_version”));
desiredCapabilities.setCapability(CapabilityType.PLATFORM, CONFIG_PROPERTIES.getProperty(“ios_platform”));
desiredCapabilities.setCapability(“device”, CONFIG_PROPERTIES.getProperty(“device_type”));
desiredCapabilities.setCapability(“app”, CONFIG_PROPERTIES.getProperty(“path_to_srm_app”));
http://blogs.technet.com/b/antino/archive/2014/09/22/how-to-set-up-a-basic-working-appium-test-environment.aspx
https://groups.google.com/forum/#!topic/appium-discuss/X5NnR_Tfh_c
http://appium.io/slate/en/master/?ruby#appium-server-capabilities
Thank you for your reply, it seems that I’m getting closer to finding a solution. At the moment when I’m adding the desired capabilties for browserName ‘Safari’ it fails. If I removed that capability from the set of desired capabilities then the application successfully launches but then fails at the .navigate step. I believe its a a fruitstrap install issue (configuration related issue) but I would be interested to hear if you have seen this before?
Hi William, I have asked to my friend who is working with this everyday and he told me the bundle id is sufficient to identify what app to launch 🙂 Are you running the ios_webkit_debug_proxy against the correct uuid ? ios_webkit_debug_proxy -c 185efa98891a6f9e0d5bac98763d7fc993ec056c:27753 -d
If you don’t have this service running – you’ll be able to launch the browser, but not interact with the web-layer thats more than likely your missing step
Hi Rafaela, thats cracked it. Not needing to run the ios_webkit_debug_proxy via emulation was where I came into difficulties when using a physical device. Thank you!
Hi William, good to know ! Thank you 🙂
I get the following error when I try to run in eclipse
Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.