Search code examples
iosappiumappium-ios

Appium can not test iOS Application "The URL '/' did not map to a valid resource"


Hi I am trying to test iOS application using Appium. I am getting following message in browser when I try to open this link http://127.0.0.1:4723/

"The URL '/' did not map to a valid resource"

Further information: Appium Version 1.5.3


Solution

  • Appium acts like a server which hosts your iOS Application. You can write your tests in java or java script for writing tests I used intern Runner and configuration of intern.js is below

    tunnel: 'NullTunnel',
    tunnelOptions: {
        hostname: 'localhost',
        port: 4444
    },
    
    'capabilities': {
        'selenium-version': '2.48.0',
        'idle-timeout': 60,
        'defaulTimeout':60,
        'chromeOptions': {'args':['allow-ra-in-dev-mode']}
    },    
    
    'environments': [
        {browserName: 'chrome'},
    
    ],
    

    Then you can write your own iOS test in iOSTest.js

    'use strict';
    
    define([
    'intern!object',
    'intern/chai!assert',
    'intern/dojo/node!underscore'],
    function(registerSuite,assert,_) {
    
    
    //set server configurations
    registerSuite({
        'name': 'iOS CoApp Testing',
    
        'setup': function() {
        },
    
        'teardown': function() {
            // executes after suite ends;
            // can also be called `after` instead of `teardown`
        },
    
        'beforeEach': function(test) {
    
        },
    
        'afterEach': function(test) {
            // executes after each test
        },
    
        'simple test': function() {
    
         // it finds text field and insert 124 in it               
              .findByXpath
              ("//UIAApplication[1]/UIAWindow[1]/UIATextField[1]")
              .click()
              .pressKeys('124')
              .end()
    
        //it finds Button and clicks it              
             .findByXpath
              ("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]")
              .click()
              .end()
    
    
    
            }
        });
    });