Looking for a "How To: Mobile web browser testing (Safari)" guide...

4,120 views
Skip to first unread message

Adam Lemisch

unread,
May 8, 2013, 12:42:34 AM5/8/13
to appium-...@googlegroups.com
Hello,

I am hoping to learn how to use Appium to create automated tests for a mobile site using Safari. What I'm really looking for is the equivalent of a WebDriver quick start guide. Something as detailed as possible along the lines of this example:


All the getting started examples that i've come across so far seem to deal with testing an installed app and not a site in a mobile browser.

I have been tinkering and asking around but I figured there might be a resource out there that would take the pain outta this process. I would like to know how and if I can use Eclipse, Maven and TestNG to create an automated test to run against a mobile web browser. Normally, for a web app I would make a new project in Eclipse, add a POM file, start making some classes that contain the page elements I would like to interact with. Then, I'd make a test class that has a WebDriver instance that navigates to the desired pages that I want to interact with. I am unable to comprehend how to point a Webdriver test written in Java at a simulator in Xcode.

I have the following:
macbook 10.8.3
Xcode 4.6.2 (With Command Line Tools and multiple iOS simulators)
Eclipse 3.7.2 (with Maven installed)
TestNG 6.4
Webdriver 2.31
Appium 1.6.3

If anyone can describe or or knows of as detailed example as possible starting from the absolute beginning (meaning from having the necessities installed) to the point where one could launch a test from Eclipse, I would deeply appreciate it. Or, if it's as simple as writing a test but with passing in some information to make the test use Appium and the ios simulator that information would be appreciated as well.

Please let me know if more details are needed.

Thanks in advance for any assistance!

Adam

Jonathan Lipps

unread,
May 8, 2013, 12:52:13 AM5/8/13
to Adam Lemisch, appium-...@googlegroups.com
Hi Adam,

A quick start guide will hopefully be coming soon. Thankfully, it's not too difficult. Appium on mobile Safari works the same as Selenium. Simply start Appium, and make sure your test uses appium's host and port as the command executor (i.e., http://localhost:4723/wd/hub), and make sure you send the following desired capabilities:

{
  'device': 'iPhone Simulator',
  'app': 'safari'
}

If you do that, Appium will launch Safari and immediately put you into webview mode, which is the same as Selenium.

Hope this helps!

Jonathan

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Aniket Gadre

unread,
May 8, 2013, 1:18:37 AM5/8/13
to Jonathan Lipps, Adam Lemisch, appium-...@googlegroups.com
Doesn't it work on Real Devices?
--
Best Regards,
Aniket Gadre
Test Automation Lead
Amdocs , Pune.
E-add: aniket...@amdocs.com

Jonathan Lipps

unread,
May 8, 2013, 1:53:15 AM5/8/13
to Aniket Gadre, Adam Lemisch, appium-...@googlegroups.com
Not yet, since it requires the remote debugger connection which is still in proof of concept for real devices.

Shawn McCarthy

unread,
May 8, 2013, 3:00:10 AM5/8/13
to appium-...@googlegroups.com
If you already have appium started (appium &  , from the Terminal), here is a simple Test:

    @Test
    public void testUsingMobileSafari() throws Exception {
    WebDriver driver;
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability("device", "iPhone Simulator");
    cap.setCapability("app", "safari");
    try {
    driver = new RemoteWebDriver(new URL("http://localhost:4723/wd/hub"), cap);
    } catch (MalformedURLException e) {
    e.printStackTrace();
    }
    driver.get("http://www.google.com");

Adam Lemisch

unread,
May 8, 2013, 8:42:46 AM5/8/13
to appium-...@googlegroups.com
LOL - I was hoping to see something like this sans the "from the Terminal". Thanks man!

Dan Cuellar

unread,
May 8, 2013, 10:27:37 AM5/8/13
to appium-...@googlegroups.com
You don't have to start appium from the terminal. The directions he supplied will work if you launch the Appium server using Appium.app as well.

Adam Lemisch

unread,
May 8, 2013, 10:56:13 AM5/8/13
to appium-...@googlegroups.com
Thanks Dan, I appreciate it!

And if I missed anyone, thanks Jonathan for your input and again thanks Shawn for the example!

Dan Riley

unread,
May 15, 2013, 12:19:53 PM5/15/13
to appium-...@googlegroups.com
Following the above example yields this in my logs:
ebug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"app":"safari","device":"iPhone Simulator"}}
info: Trying to use mobile safari, version 6.0
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: ENOENT, stat '/Users/riled025/Library/Application Support/iPhone Simulator/6.0/Library'
error: Could not find support directory for mobile safari, does it exist at /Users/riled025/Library/Application Support/iPhone Simulator/6.0/Library?
info: Got configuration error, not starting session
error: Failed to start an Appium session, err was: Error: Could not find support directory for mobile safari, does it exist at /Users/riled025/Library/Application Support/iPhone Simulator/6.0/Library?
info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started (Original error: Could not find support directory for mobile safari, does it exist at /Users/riled025/Library/Application Support/iPhone Simulator/6.0/Library?)","origValue":"Could not find support directory for mobile safari, does it exist at /Users/riled025/Library/Application Support/iPhone Simulator/6.0/Library?"},"sessionId":"9bb25cdb-faf1-445e-acb7-5c2b85ec12ba"}
POST /wd/hub/session 500 175ms - 477
debug: 127.0.0.1 - - "POST /wd/hub/session HTTP/1.1" 500 477 "-" "-"

I am using appium.app (v0.5.1)

Adam Lemisch

unread,
May 15, 2013, 10:29:40 PM5/15/13
to appium-...@googlegroups.com
Dan,

I think I ran into something similar. When I checked the path in the output, "error: Could not find support directory for mobile safari, does it exist at /Users/riled025/Library/Application Support/iPhone Simulator/6.0/Library?", everything was there on my machine with the exception of "6.0". I had 6.1 so, I wound up renaming that folder to "6.0" (since that's what Appium seemed to be looking for) and it worked. A few days later the 6.1 directory showed up in my simulators anyway.

Hope that helps,

Adam

Shailendra Singh

unread,
Jun 24, 2013, 7:40:22 AM6/24/13
to appium-...@googlegroups.com, Adam Lemisch
what key and values should be send in desired capabilities to test web apps on android on windows 7?

Jonathan Lipps

unread,
Jun 25, 2013, 11:25:54 AM6/25/13
to Shailendra Singh, appium-...@googlegroups.com, Adam Lemisch
The keys will be:

{
  'device': 'Android',
  'app': 'Chrome'
}

But this functionality has not been cleaned up and merged into master. Furthermore it will require Chrome to exist on the device.

Message has been deleted

Victor Hooi

unread,
Jan 28, 2014, 8:24:25 PM1/28/14
to appium-...@googlegroups.com, Shailendra Singh, Adam Lemisch
Hi,

I'd would also love a Getting Started guide for Appium and Mobile Safari guide =).

I'm trying to test a website on iOS/Android browsers.

I've launched the Appium.app, and I've chmod 777-ed 

However, I'm then hitting issues with "iOS Simulator failed to install the application".

https://github.com/appium/appium/issues/1822

So yes, a step-by-step guide would be awesome

Cheers,
Victor
Reply all
Reply to author
Forward
0 new messages