Mobile Web automation on iOS real device – Safari

Hi Amarnath,
Really appreciate your initiative. This will definitely help our community and mobile world.

Thanks,
Donald

1 Like

Hi Amarnath ,

Thanks for sharing the information.
After configuring everything I am not able to laucnh URL using “driver.get(“http://www.google.com”);”

can you please help me out?

Thanks,
Amol

@AmarnathRayudu Are you able to continuously run SafariBrowser in iOS real device. Like some 100+ testscripts continuosly without any break/stall???

Hi @Mobile_Test_Test ,
We are also doing automation on real device on iOS on safari, but test execution is not stable. We face issues with stale tabs which remain in the browser in case a script fails. Now we are facing an issue when we try to click an element which opens a new tab. As soon as new tab is opened we see an issue in appium server- The target application appears to have died. Do you have any idea about this issue ?

Hi All,

Can any one of you please let me know how to open the safari from Xcode ?

Thanks in advance!

Hi All,

I have gone through the above the Pre-requisites and I have done the same set up but I got stuck @ one step.

These things I have already done - SafariLauncher is installed via XCODE on IPAD Mini Air (9.3) and device is also connected using os-webkit-debug-proxy.

But when I am running test I am getting below exception

==================================================

info: [debug] Error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
at Error (native)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’)”,“errno”:-2,“code”:“ENOENT”,“path”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip",“origValue”:“ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’”},“sessionId”:null}

error: Failed to start an Appium session, err was: Error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’

info: <-- POST /wd/hub/session 500 162.301 ms - 498

===========================================

Can anyone guide me here ??

Thanks & Regards
Mukesh

1 Like

Hey @Mukesh_otwani, can you please tell me how to do that ? how to get the xcode project and launch it from xcode ?

Download XCode and Install it. After installation import the SafariLauncher in xcode and Run it.

Once build is successful, it will installed SafariLauncher in your device

Friends, I did all my setup. That is setting up Safari Launcher and webkit proxy as well. The problem is when I start the test Safari Launcher starts and opens up the browser but no URL launches. Just the apple.com page launches.

The same test runs well on Simulator.

Hey @yukonpd, you should launch the url from your test scripts, not the SafariLauncher.
If you would like to change the first launched page from the SafariLauncher, you should open it with Xcode and change the Default Value of Root.plist

1 Like

Thanks @mferturk for your reply,
I launched the URL from the test scripts itself, below is the snippet:

Web driver class{

  private WebDriver setMobileDriver(Map<String, String> selConfig) {

        DesiredCapabilities cap = new DesiredCapabilities();
	String [] appiumDeviceConfig = selConfig.get("mobileDevice").split(":"); 
	cap.setCapability("deviceName", appiumDeviceConfig[0]);
	cap.setCapability("automationName", "Appium");
	cap.setCapability("platformName", "iOS");
	String appiumServerHostUrl = selConfig.get("appiumServer");
	URL appiumServerHost = null;
	try {
		appiumServerHost = new URL(appiumServerHostUrl);
	} catch (MalformedURLException e) {
		e.printStackTrace();
	}
	cap.setJavascriptEnabled(true);
	System.out.println(appiumServerHostUrl);
	AppiumDriver driver=new IOSDriver(appiumServerHost, cap);
	
	try {
		Thread.sleep(30000);
		System.out.println("now entering url");
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	driver.get("https://google.com");

Just to remind the same lines work on the Simulator, I have appium 3.1.0 version under my POM.xml. Just let me know if you need more info.

Please change the url driver.get("

https://google.com

"); to

https://www.google.com/

Hi Friends,

My mobile application is a iOS Native app. Please go through the below steps

  1. After Launching the app there is a button called Forgot Your PIN
  2. When we click on Forgot Your PIN button.
  3. The application will redirect to a Safari Web page where I have the below fields.
  4. Mobile Number, Last Name and Data of Birth Picker.
  5. I am unable to tap or select Mobile Number field by using Tap feature of Safari browser using Appium Inspector.

So please someone help me how to tap or select Mobile number field of a browser.

Hi yukonpd,

I have the same issue with you.
Did you solve it? Could you share for us your solution?

Hi otwani

I have the same issue with you.
Did you solve it? Could you share for us your solution?

Hi Friends,

No till now I did not get any solution, if anything is there i will let you know guys.

Thanking you,
Bhaskar.M

Hi, I am facing issue with safari on real device. SafariLauncher opens the safari browser on device but did not hit my URL.
set following capabilities
deviceUDID= xxxxxx
bundleid= com.apple.mobilesafari
appium-version =1.4.11
browserName =Safari
platformName =iOS
deviceName =iPhone 6
platformVersion =8.4

Hi Mukesh,

I am facing the same issue. could you pls share the solution?

Hi Mukesh,

I got the same error which you were getting earlier, could you please confirm whether you got a solution for this.

info: --> POST /wd/hub/session {“desiredCapabilities”:{“appium-version”:“1.4.13”,“platformName”:“iOS”,“deviceName”:“Bin_iPhone”,“udid”:“1f789643be7b96813c4d2ae5b037bc27cb1b4a26”,“bundleId”:“com.binoy.safarilauncher”,“browserName”:“safari”,“version”:“8.4.1”}}

info: Client User-Agent string: undefined
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
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. : appium-version, version

error: Failed to start an Appium session, err was: Error: ENOENT, stat '/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’

info: [debug] Configuring Safari session
info: [debug] Using local .zip from command line: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip
info: [debug] Copying local zip to tmp dir
info: [debug] Got configuration error, not starting session
info: [debug] Cleaning up appium session
info: [debug] Error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
at Error (native)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’)”,“errno”:-2,“code”:“ENOENT”,“path”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip",“origValue”:“ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 4.849 ms - 498

Thanks
Bin

Hi Everyone.

I couldn’t understand setp2 , if you can explain in details. rest all i did and my Safari launcher installed on Iphone. I can load it mannualy but when i use Appium to Launch.

  1. Server Run without Any Error
  2. Mobile asked for Passcode
  3. Once Passcode Entered nothing happen- Application Didn’t open
  4. Server running
  5. No Java Errors

Can anyone help please what i am doing wrong.

Thanks