Safari on iOS via safari launcher

5,595 views
Skip to first unread message

Pavithra

unread,
Sep 2, 2013, 9:51:50 AM9/2/13
to appium-...@googlegroups.com
How should I start the appium server to launch safari on real device ? I am stuck up with this, kindly help out!!

I installed safarilauncher on my device..

I started appium server (0.8.5) (GUI) providing properly UDID with force ipad and use Mobile Safari checked. I didnt provide the bundle id (hope it is not required to start safari on ios) - kindly clarify ? or do i need to specify bundle id of safarilauncher ? 

Here is my test:

private static WebDriver driver;
@BeforeTest
public void setUp() throws Exception {
DesiredCapabilities caps = new DesiredCapabilities();

    caps.setCapability("app", "safari");
    caps.setCapability("device", "iPad Device");
    caps.setCapability("version", "6.1");

    driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub/"), caps);
    System.out.println("Pausing.. Manually switch to safari now..");
    //here i manually switched to safari on the device
    Thread.sleep(10000);
    for(String winHandle : driver.getWindowHandles()){
        driver.switchTo().window(winHandle);
    }
    driver.get("http://mail.aol.com");
    Thread.sleep(5000);
}

First of all when it is instantiating the remotewebdriver, it is 
launching the ipad simulator (does it launch even when we want to run on
 device only) opens the safari browser and then throws the below errror 
in appium console:



info: Welcome to Appium v0.8.5 (REV 3a6720dd1204c04a4fe89a4482eb87366394acca)

info: Appium REST http interface listener started on 127.0.0.1:4723

info: socket.io started

debug: Appium request initiated at /wd/hub/session

info: Trying to use mobile safari, version 6.1

debug: Request received with params: {"desiredCapabilities":{"app":"safari","device":"iPad Device","version":"6.1"}}

info: Looking for built in app MobileSafari

info: Got app, trying to copy to tmp dir

info: Copied MobileSafari to /tmp/Appium-MobileSafari.app

info: Using mobile safari app at /tmp/Appium-MobileSafari.app

info: Cleaning mobile safari data files

info: Determining current user

info: User is pavithrank

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Caches/Snapshots/com.apple.mobilesafari

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Caches/com.apple.mobilesafari/Cache.db*

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Caches/com.apple.WebAppCache/*.db

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Safari/*.plist

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/WebKit/LocalStorage/*.*

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Library/WebKit/GeolocationSites.plist

info: Deleting /Users/pavithrank/Library/Application\ Support/iPhone\ Simulator/6.1/Library/Cookies/*.binarycookies

info: Creating new appium session 879b4a92-7fb6-458b-897a-a9a051dec790

debug: No device id or app, not installing to real device.

info: Cleaned up instruments socket /tmp/instruments_sock

info: Not setting device type since we're connected to a device

debug: Creating instruments

info: instruments is: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [INSTSERVER] Instruments socket server started at /tmp/instruments_sock

info: Attempting to run app on real device with UDID UDIDVALUE

info: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Appium.app/Contents/Resources/node_modules/appium/app/uiauto/Automation.tracetemplate -w UDIDVALUE /tmp/Appium-MobileSafari.app -e UIASCRIPT /Applications/Appium.app/Contents/Resources/node_modules/appium/app/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments/

info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/usr/lib/libgenkit.dylib"}

error: Instruments socket client never checked in; timing out

error: Instruments did not launch successfully, failing session

error: Failed to start an Appium session, err was: Instruments did not launch successfully--please check your app paths or bundle IDs and try again

info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"Instruments did not launch successfully--please check your app paths or bundle IDs and try again"},"sessionId":"879b4a92-7fb6-458b-897a-a9a051dec790"}

POST /wd/hub/session 500 303283ms - 270

info: Clearing out appium devices

Thanks,

Pavithra

Dan Cuellar

unread,
Sep 3, 2013, 11:57:32 AM9/3/13
to appium-...@googlegroups.com
If you use a real device do not select force ipad.

For real devices you need the UDID and BundleID (do NOT use app path)

Also, make sure the device you are using has the proper certs and provisioning profiles to run the app. Look at Apple's documentation on debugging a real device with XCode.

Rohit Kadam

unread,
Sep 13, 2013, 4:57:45 AM9/13/13
to appium-...@googlegroups.com
I am trying to do the same thing i.e launch safari on real device.

I have few questions.
1. How did you install safari launcher app on real device? (Do you have any link from where I can get that app?)
2. What is the Bundle id value to put in appium for safari on real device?
3. Were you able to launch safari successfully on real device?

Thanks,
Rohit

Pavithra

unread,
Sep 13, 2013, 5:22:32 AM9/13/13
to appium-...@googlegroups.com
Rohit,

This is where Safarilauncher is: https://github.com/budhash/SafariLauncher
Once you install the app on real device via xcode: you will find the app in ur directory: /Users/username/Library/Developer/Xcode/DerivedData/
For bundle id you have to give the whole path along with .app

Also, you should provide the UDID value of the device correctly. No need to check force ipad/iphone or usemobilesafari checkboxes.

I hope you know how to provision ur device and install the app on the device: If not, please follow the steps from my blog here: http://pavithz.blogspot.in/2012/09/iwebdriver-on-ipadiphone.html [Instead of installing webdriver you have to install safarilauncher here].

Also follow this doc: https://github.com/appium/appium/blob/master/docs/hybrid.md to install ios-webkit-proxy (to run the tests on the real device)

I could launch safari successfully in the device but it is inconsistent. Sometimes after launching safari, instrument is not responding back to appium. Hence, I am currently using WebViewapp to test on real devices. For more info look into this thread fully: https://github.com/appium/appium/issues/1083

Thanks,
Pavithra

Rohit Kadam

unread,
Sep 13, 2013, 6:44:15 AM9/13/13
to Pavithra, appium-...@googlegroups.com
Thanks a ton for steps.
Finally I could launch the safari on real device :)

Following is my simple code which I am trying to execute.

require 'selenium-webdriver'

APP_PATH = "/Users/use/Library/Developer/Xcode/DerivedData/SafariLauncher-eccrfyirwnmjdbgywjwkfakhwkzp/Build/Products/Debug-iphoneos/SafariLauncher.app"

capabilities = {
  'browserName' => 'iOS',
  'platform' => 'Mac',
  'version' => '6.1',
  'app' => APP_PATH
}

server_url = "http://127.0.0.1:4723/wd/hub"

@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

# After above step safari launcher open safari browser on real device and tries to open the URL http://www.apple.com
# But it never returns the browser object instead I get an Timeout::Error

My questions:
1. How can change the URL apple.com to some other google.com?
2. Why I am getting Timeout:Error?

Note:-
Also I started the ios-websocket-proxy with correct UDID.

Thanks,
Rohit



--
http://appium.io
---
You received this message because you are subscribed to a topic in the Google Groups "Appium-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/appium-discuss/XVIuzcd79zo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Rohit Kadam

unread,
Sep 13, 2013, 6:53:01 AM9/13/13
to Pavithra, appium-...@googlegroups.com
Adding debug logs of Timeout:Error inline




On Fri, Sep 13, 2013 at 4:14 PM, Rohit Kadam <rohit....@gmail.com> wrote:
Thanks a ton for steps.
Finally I could launch the safari on real device :)

Following is my simple code which I am trying to execute.

require 'selenium-webdriver'

APP_PATH = "/Users/use/Library/Developer/Xcode/DerivedData/SafariLauncher-eccrfyirwnmjdbgywjwkfakhwkzp/Build/Products/Debug-iphoneos/SafariLauncher.app"

capabilities = {
  'browserName' => 'iOS',
  'platform' => 'Mac',
  'version' => '6.1',
  'app' => APP_PATH
}

server_url = "http://127.0.0.1:4723/wd/hub"

@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

Debug logs:-

lities, :url => server_url)
Timeout::Error: Timeout::Error
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1294:in `request'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:746:in `start'
        from /Users/user/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1285:in `request'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:99:in `create_session'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/common/driver.rb:33:in `new'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/common/driver.rb:33:in `for'
        from /Users/user/.rvm/gems/ruby-1.9.3-p429/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver.rb:67:in `for'

Pavithra

unread,
Sep 13, 2013, 6:55:42 AM9/13/13
to appium-...@googlegroups.com, Pavithra
Yes thats because Safari app is getting launched after a delay. In the app by default they have given 20 seconds delay, you can try changing that delay in the code and install the app again and try out. But as I mentioned before, for me: even after changing the delay to say 45 seconds also its not responding back.

Say suppose: it responds back you have to use the following code to get the window handle and navigate to specific url:

Set<String> windowHandles = driver.getWindowHandles();

String nextWindowName = windowHandles.iterator().next();

driver.switchTo().window(nextWindowName);

driver.get("urlvalue");

Did you look into the github issue thread: https://github.com/appium/appium/issues/1083 [I have posted the issue what I get w.r.t safari launcher and appium developer suggests us to use webviewapp till the issue with safarilauncher gets resolved.]

I am using webviewapp (it doesnt launch safari) however it gives the same web view as in safari.

Pavithra !

Rohit Kadam

unread,
Sep 13, 2013, 7:45:08 AM9/13/13
to Pavithra, appium-...@googlegroups.com
Hi Pavithra

I changed 20 seconds to 50 seconds and launched the app again but it showing me the same result.

So I think I should use the webviewapp.

Sorry for the trouble but do you have useful documentation about webviewapp? so that I can test my website on real device.

Steps you provided for safarilauncher are superb.

Thanks,
Rohit


--

Pavithra

unread,
Sep 13, 2013, 7:55:46 AM9/13/13
to appium-...@googlegroups.com, Pavithra
Rohit, Steps for installing any app is same as what I mentioned in my blog for webdriver.
To get the webview it is present here: https://github.com/appium/appium/tree/master/sample-code/apps/WebViewApp But to get this you have to check out the whole repository https://github.com/appium/appium (not just webviewapp). Once you checkout the whole appium then you take webviewapp from sample-code/apps directory and install it in the device as you did for safarilauncher.

Once you install the app, you can find the app in the similar directory /Users/uservalue/Library/.....  change the bundleid accordingly in your appium server and start the server. 
Run the ios-webkit-proxy (with proper device id) in the background. 
All steps are same (even getting window handle and navigating to url is same); only the app is different.

Hope it helps!!

Rohit Kadam

unread,
Sep 13, 2013, 8:14:16 AM9/13/13
to Pavithra, appium-...@googlegroups.com
Hi Pavithra,

Thanks, I am able to launch the webviewapp now.
I can see the default url as http://saucelabs.com/test/guinea-pig

But still  following code giving me Timeout:Error


@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

As you mentioned I did all the settings.

My configuration are:-
Mac 10.8.4
iOS 6.1.3
Xcode 4.6.2


--

Pavithra

unread,
Sep 13, 2013, 8:24:36 AM9/13/13
to appium-...@googlegroups.com, Pavithra
Which language u are using?
With Java this is how its set: I am not sure how to set using other language..

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
 desiredCapabilities.setCapability("device", "iPhone Simulator");
 desiredCapabilities.setCapability("app", "webviewapppath along with .app");  
 URL url = new URL("http://127.0.0.1:4723/wd/hub");
 RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities);

  //switch to the latest web view
  for(String winHandle : remoteWebDriver.getWindowHandles()){
    remoteWebDriver.switchTo().window(winHandle);
  }
driver.get("urluwanttonavigate");

Rohit Kadam

unread,
Sep 13, 2013, 8:35:26 AM9/13/13
to Pavithra, appium-...@googlegroups.com
I am using ruby.

My Code:-

require 'selenium-webdriver'

APP_PATH = "/Users/vertis/Library/Developer/Xcode/DerivedData/WebViewApp-gwxcegwdeegpaabjdjrbhioayign/Build/Products/Debug-iphoneos/WebViewApp.app"

server_url = "http://127.0.0.1:4723/wd/hub"

capabilities = {
  'browserName' => 'iOS',
  'platform' => 'Mac',
  'version' => '6.1',
  'app' => APP_PATH
}

@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

After above step I get Timeout:Error

I compared both codes java and ruby, looks similar.

Is it something the language issue?

Thanks,
Rohit


Pavithra

unread,
Sep 13, 2013, 8:43:49 AM9/13/13
to appium-...@googlegroups.com, Pavithra
Language doesn't matter. I dont know how to set in other language other than java (that is what I mentioned).
In above code: I could see you setting browserName as ios. Instead try with device => ipad simulator or iphone simulator. Thats the only difference I could see, but I am not sure whether that helps!

Rohit Kadam

unread,
Sep 13, 2013, 9:07:43 AM9/13/13
to Pavithra, appium-...@googlegroups.com
I changed it to the device => iPhone Simulator but no luck :(

Anyways, thanks for all your help in this. I really appreciate it.

Now I am gonna create issue on appium github for ruby and I will try your java code

Thanks,
Rohit



On Fri, Sep 13, 2013 at 6:13 PM, Pavithra <pav...@gmail.com> wrote:
Language doesn't matter. I dont know how to set in other language other than java (that is what I mentioned).
In above code: I could see you setting browserName as ios. Instead try with device => ipad simulator or iphone simulator. Thats the only difference I could see, but I am not sure whether that helps!

--

Pavithra Navaneeth

unread,
Sep 13, 2013, 9:19:49 AM9/13/13
to Rohit Kadam, appium-...@googlegroups.com
Fine !! Did you tried with ipad also ? Just to confirm whether it is fine .. Because with iphone - even I am getting some exception. While trying to get the window handles - app just crashes. However with ipad - it succeeds. So just try with ipad once !!
--
Thanks & Regards,
Pavithra Navaneeth

Pavithra

unread,
Sep 17, 2013, 9:09:27 AM9/17/13
to appium-...@googlegroups.com, Rohit Kadam
Rohit, Did you got it working on the devices ?
Note: I could launch webviewapp and test on iphone as well now. Problem was I didnt enabled the webinspector under safari settings on iphone. After enabling, it is fine now.
So, if you still facing the issue; just check whether u have enabled the webinspector on ur real device !!

Thanks,
Pavithra

Bhupendra Kumar

unread,
Sep 17, 2013, 10:15:28 AM9/17/13
to Pavithra, appium-...@googlegroups.com, Rohit Kadam
Hi Pavithra,

You can open the Safari web inspector or web view app also … Just make sure that you need to disconnect the appium and iOS-webkit proxy.

Thanks
Bhupen

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.

Rohit Kadam

unread,
Sep 17, 2013, 12:44:54 PM9/17/13
to Bhupendra Kumar, Pavithra Navaneeth, appium-...@googlegroups.com
Hi Pavithra,

I enabled the web inspector under safari settings still its showing me Timeout:Error.

Before executing following line:-


@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

I started my appium server, ios-webkit-proxy with device UUID

What could be the problem now?

Thanks,
Rohit

Rohit Kadam

unread,
Oct 7, 2013, 4:59:26 AM10/7/13
to Bhupendra Kumar, Pavithra Navaneeth, appium-...@googlegroups.com
Hi Pavithra,

I tried java code but still its failing with Timeout error.

My java code-


import java.net.MalformedURLException;

import java.net.URL;


import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebDriverException;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.remote.DesiredCapabilities;

import org.openqa.selenium.remote.RemoteWebDriver;

import org.openqa.selenium.support.ui.ExpectedConditions;

import org.openqa.selenium.support.ui.WebDriverWait;


public class Test {

public static void main(String args[]) throws MalformedURLException, InterruptedException{

System.out.println("Pausing.. Manually switch to safari now..");

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();

desiredCapabilities.setCapability("device", "iPhone Simulator");

desiredCapabilities.setCapability("app", "/Users/demo/Library/Developer/Xcode/DerivedData/WebViewApp-gwxcegwdeegpaabjdjrbhioayign/Build/Products/Debug-iphoneos/WebViewApp.app");

try {

URL url = new URL("http://127.0.0.1:4723/wd/hub");

RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url, desiredCapabilities);

System.out.println("Pausing.. Manually switch to safari now..");

Thread.sleep(5000);

//switch to the latest web view

for(String winHandle : remoteWebDriver.getWindowHandles()){

remoteWebDriver.switchTo().window(winHandle);

}

remoteWebDriver.get("http://www.facebook.com");

Thread.sleep(5000);

} catch (WebDriverException e) {

System.out.println(e.getMessage());

}

}

}

If I run above code I get the following exception in eclipse console:-

A session is either terminated or not started (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 300.15 seconds

Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'

System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.6.0_51'

Driver info: org.openqa.selenium.remote.RemoteWebDriver


What could be the problem? Do I need to increase the timeouts of webview app or something?


Thanks,

Rohit

Sriram

unread,
Mar 12, 2014, 7:52:23 AM3/12/14
to appium-...@googlegroups.com
Hi ,

Please help me, as I have been too facing the same issue that you were discussing.

I had got safari launcher get opened in my ipad for the first time but navigated to apple.com instead the url I gave.(Might be time out error as you guys told)

But for the next execution I am facing unreachable browser exception.

Here is my console.

org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:11:15'
System info: host: 'tscsp001.local', ip: '10.1.3.60', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.1', java.version: '1.6.0_65'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at com.target.appiumweb.MainController.setup(MainController.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
at java.net.Socket.connect(Socket.java:527)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:337)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:298)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
... 28 more

java.lang.NullPointerException
at com.target.appiumweb.MainController.tearDown(MainController.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)




my java code is:



    public void setup() throws Exception

    {

        DesiredCapabilities cap = new DesiredCapabilities();

        String myApp = "/Users/testing/Library/Developer/Xcode/DerivedData/SafariLauncher-coidnmjoofuxfnayfnsfoispntmz/Build/Products/Debug-iphoneos/SafariLauncher.app";

        cap.setCapability("device", "ipad");

        cap.setCapability("app", myApp);

        cap.setCapability("version", "7.0.4");

        driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), cap);

        System.out.println("connected1");

        baseUrl= "http://www.google.com";

    }   


    @After

    public void tearDown() throws Exception

    {

        driver.quit();


    }


    @Test

    public void test() throws Exception

    {

    for(String winHandle : driver.getWindowHandles()){

    driver.switchTo().window(winHandle);

    }

this.driver.get(baseUrl);

}


The following steps I have followed:

1. Started the ios-webkit-debug-proxy with the specific UDID

2.Opened and got into develop mode. Also checked the webinspector for mobile safari in device.

3. Launched appium server and run the test.

Please help me in getting solved and correct me where im wrong.

Thanks

Alex Arkanov

unread,
Mar 12, 2014, 1:46:49 PM3/12/14
to appium-...@googlegroups.com
just to help out, i had some issues with safarilauncher as well but was able to get them resolved.

Sam

unread,
Jun 16, 2014, 3:44:28 PM6/16/14
to appium-...@googlegroups.com
I m trying to test a website on safari using ipad simulator and appium . I have the code in testNG and I am running it on eclipse. I am using SafariLauncher and have its .app and bundle ID through Xcode

However, i am getting the error 

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: We don't have write access to /Applications/Xcode.app/.....


please guide

thanks
sonam 

On Monday, September 2, 2013 6:51:50 AM UTC-7, Pavithra wrote:

Manju Muthaiya

unread,
Jul 11, 2014, 7:17:14 AM7/11/14
to appium-...@googlegroups.com
To automate Safari, you do not need to open SafariLauncher from your code. Appium uses SafariLauncher internally to launch safari. Just replace cap.setCapability("app",myApp)
with this line:

cap.setCapability("browserName","Safari").

Only then will you be able to control the Safari app, open a url you specify etc. 

Note: According to the docs, if you want to run safari on a real iOS device, you need to clone appium from the repository and run the reset.sh script using the --real-safari flag (probably so that appium's internal SafariLauncher can be signed with your custom provisioning profiles.. not sure). Here's the link to the detailed steps in the docs:


Hope that helps.

Aruna Pendyala

unread,
Aug 21, 2014, 9:40:18 AM8/21/14
to appium-...@googlegroups.com
Hi,

I am trying to test a mobile web on an iPhone(version 7.1) device. I followed the steps given in the Appium docs for real device setup.
The safari browser is getting launched on the device but its not executing the commands in my script.

I am using the capabilities:

capabilities.setCapability("browserName", "Safari");

I see the below error in the console:

info: Launching instruments

debug: Attempting to run app on real device with UDID e223246c1606a5bec52008a6b58919236cfc4a3f

debug: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w e223246c1606a5bec52008a6b58919236cfc4a3f /var/folders/n6/6_3mpqxn1bvgtmj1wdvrqs1wmrs8fk/T/114720-4499-iyd3z8/submodules/SafariLauncher/build/Release-iphoneos/SafariLauncher.app -e UIASCRIPT /Users/ksharma/Library/Application Support/appium/bootstrap/bootstrap-a1eb991c1f709a20.js -e UIARESULTSPATH /tmp/appium-instruments

debug: And extra without-delay env: {}

debug: And launch timeouts (in ms): {"global":90000}

debug: [INST] 2014-08-20 20:43:55 +0000 Fail: Could not start script, target application is not frontmost.

       Instruments Trace Complete (Duration : 19.497269s; Output : /tmp/appium-instruments/instrumentscli0.trace)

 

debug: [INSTSERVER] Instruments exited with code 0

debug: Cleaning up after instruments exit

debug: Not worrying about instruments exit since we're using SafariLauncher


Please help me to get this resolved.

Thanks,
Aruna

Isaac Murchie

unread,
Aug 21, 2014, 11:10:47 AM8/21/14
to Aruna Pendyala, appium-...@googlegroups.com
I think this should be addressed soon. See https://github.com/appium/appium/pull/3440


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss.
For more options, visit https://groups.google.com/d/optout.

Aruna Pendyala

unread,
Aug 21, 2014, 11:36:02 AM8/21/14
to appium-...@googlegroups.com, aruna.p...@gmail.com
Thanks Issac for the quick reply.

But can you let me know if there is any work-around for this, as we are blocked to execute our scripts on iOS device.

Isaac Murchie

unread,
Aug 21, 2014, 11:38:03 AM8/21/14
to Aruna Pendyala, appium-...@googlegroups.com
Other than getting that patch and putting it in your codebase, I don't think so.

mogu...@gmail.com

unread,
Aug 22, 2014, 3:46:28 AM8/22/14
to Aruna Pendyala, appium-...@googlegroups.com
Hi Aruna,
I am testing web apps using Safari on iOS7.1.2 by using Appium version 1.1.0.

I actually had trouble installing safariLauncher came with appium 1.1.0, so I grabbed the launcher
from appium 1.2.1, then running appium server 1.1.0 tho.

hth,
Reply all
Reply to author
Forward
0 new messages