@wreed Thanks a lot. The app is getting invoked after setting the environment variable in Eclipse IDE.
But now I am getting a new error. The safari launcher is getting invoked but the website is not getting invoked.
My Java Code is as follows-
CommandLine command = new CommandLine("/Applications/Appium.app/Contents/Resources/node/bin/node");
command.addArgument("/usr/local/lib/node_modules/appium/build/lib/main.js",false);
command.addArgument("--address", false);
command.addArgument("0.0.0.0");
command.addArgument("--port", false);
command.addArgument("4723");
command.addArgument("-bp", false);
command.addArgument("4724");
command.addArgument("--session-override", true);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);
try {executor.execute(command, resultHandler);
Thread.sleep(5000);System.out.println("Appium server started.");}
catch (IOException e)
{e.printStackTrace();}
catch (InterruptedException e)
{e.printStackTrace();}
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"iOS");
capabilities.setCapability("udid","dea1eeecfba536a2a929ba1b11f7825b1da8c4f4");
capabilities.setCapability("app","/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app");
capabilities.setCapability("automationName","XCUITest");
driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
driver.get("http://www.google.com");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//driver.quit();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
The eclipse console (error) is as follows–
[Appium] Welcome to Appium v1.6.3
[Appium] Non-default server args:
[Appium] sessionOverride: true
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
Appium server started.
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“automationName”:“XCUITest”,“app”:"/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app",“deviceName”:“iOS”,“platformName”:“iOS”,“udid”:“dea1eeecfba536a2a929ba1b11f7825b1da8c4f4”}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“automationName”:“XCUITest”,“app”:"/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app",“deviceName”:“iOS”,“platformName”:“iOS”,“udid”:“dea1eeecfba536a2a929ba1b11f7825b1da8c4f4”},null,null,null,null]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1490848124338 (09:58:44 GMT+0530 (IST))
[Appium] Creating new XCUITestDriver session
[Appium] Capabilities:
[Appium] automationName: ‘XCUITest’
[Appium] app: ‘/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app’
[Appium] deviceName: ‘iOS’
[Appium] platformName: ‘iOS’
[Appium] udid: ‘dea1eeecfba536a2a929ba1b11f7825b1da8c4f4’
[debug] [XCUITest] XCUITestDriver version: 2.23.1
[BaseDriver] Session created with session id: aee2481b-135d-4f01-9777-0620a6e854ae
[debug] [XCUITest] Xcode version set to ‘8.2.1’ (tools v8.2.0.0.1.1480973914)
[debug] [XCUITest] iOS SDK Version set to ‘10.2’
[debug] [BaseDriver] Event ‘xcodeDetailsRetrieved’ logged at 1490848124484 (09:58:44 GMT+0530 (IST))
[debug] [XCUITest] Available devices: dea1eeecfba536a2a929ba1b11f7825b1da8c4f4
[debug] [XCUITest] Creating iDevice object with udid ‘dea1eeecfba536a2a929ba1b11f7825b1da8c4f4’
[XCUITest] Determining device to run tests on: udid: ‘dea1eeecfba536a2a929ba1b11f7825b1da8c4f4’, real device: true
[BaseDriver] Using local app ‘/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app’
[debug] [BaseDriver] Event ‘appConfigured’ logged at 1490848124575 (09:58:44 GMT+0530 (IST))
[debug] [XCUITest] Checking whether app ‘/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app’ is actually present on file system
[debug] [XCUITest] App is present
[debug] [iOS] Getting bundle ID from app ‘/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app’: ‘com.lnt.safarilauncher’
[debug] [BaseDriver] Event ‘resetStarted’ logged at 1490848124580 (09:58:44 GMT+0530 (IST))
[debug] [XCUITest] Reset: running ios real device reset flow
[debug] [BaseDriver] Event ‘resetComplete’ logged at 1490848124581 (09:58:44 GMT+0530 (IST))
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: ‘/usr/local/bin/idevicesyslog’
[debug] [BaseDriver] Event ‘logCaptureStarted’ logged at 1490848124877 (09:58:44 GMT+0530 (IST))
[XCUITest] Setting up real device
[debug] [XCUITest] Reset requested. Removing app with id ‘com.lnt.safarilauncher’ from the device
[debug] [XCUITest] Installing ‘/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app’ on device with UUID ‘dea1eeecfba536a2a929ba1b11f7825b1da8c4f4’…
[debug] [XCUITest] The app has been installed successfully.
[debug] [BaseDriver] Event ‘appInstalled’ logged at 1490848128771 (09:58:48 GMT+0530 (IST))
[debug] [BaseDriver] Event ‘wdaStartAttempted’ logged at 1490848128774 (09:58:48 GMT+0530 (IST))
[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: ‘/usr/local/bin/carthage’
[debug] [XCUITest] Killing hanging processes
[debug] [XCUITest] Beginning test with command ‘xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=dea1eeecfba536a2a929ba1b11f7825b1da8c4f4 -configuration Debug’ in directory ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[debug] [XCUITest] Output from xcodebuild will not be logged
[debug] [XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB
[debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [XCUITest] Log file for xcodebuild test: /Users/lntinfotech/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/3B251CFB-84EF-4EB3-A4C1-7F550E12FDE9/Session-WebDriverAgentRunner-2017-03-30_095855-s4fIWq.log
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: “{\n “sessionId” : “23F56F1A-FA29-4DE8-8959-CFF901AD3E5F”,\n “value” : {\n “state” : “success”,\n “os” : {\n “name” : “iOS”,\n “version” : “10.2”\n },\n “ios” : {\n “ip” : “192.168.2.2”,\n “simulatorVersion” : “10.2”\n },\n “build” : {\n “time” : “Mar 23 2017 18:42:43”\n }\n },\n “status” : 0\n}”
[debug] [XCUITest] WebDriverAgent running on ip ‘192.168.2.2’
[debug] [XCUITest] WebDriverAgent successfully started after 10876ms
[debug] [BaseDriver] Event ‘wdaSessionAttempted’ logged at 1490848144744 (09:59:04 GMT+0530 (IST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {“desiredCapabilities”:{“bundleId”:“com.lnt.safarilauncher”,“arguments”:[],“environment”:{},“shouldWaitForQuiescence”:true}}
[debug] [JSONWP Proxy] Got response with status 200: {“sessionId”:“A9B7D699-A39D-4A00-AD2E-EFC8B671874E”,“value”:{“sessionId”:“A9B7D699-A39D-4A00-AD2E-EFC8B671874E”,“capabilities”:{“browserName”:“SafariLauncher”,“device”:“ipad”,“CFBundleIdentifier”:“com.lnt.safarilauncher”,“sdkVersion”:“10.2”}},“status”:0}
[debug] [BaseDriver] Event ‘wdaSessionStarted’ logged at 1490848148624 (09:59:08 GMT+0530 (IST))
[debug] [XCUITest] Found WDA derived data folder: ‘/Users/lntinfotech/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy’
[XCUITest] Setting ‘555’ permissions to ‘/Users/lntinfotech/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/Attachments’ folder
[debug] [BaseDriver] Event ‘wdaPermsAdjusted’ logged at 1490848148627 (09:59:08 GMT+0530 (IST))
[debug] [BaseDriver] Event ‘wdaStarted’ logged at 1490848148628 (09:59:08 GMT+0530 (IST))
[debug] [XCUITest] Setting initial orientation to ‘PORTRAIT’
[debug] [JSONWP Proxy] Proxying [POST /orientation] to [POST http://localhost:8100/session/A9B7D699-A39D-4A00-AD2E-EFC8B671874E/orientation] with body: {“orientation”:“PORTRAIT”}
[debug] [JSONWP Proxy] Got response with status 200: {“sessionId”:“A9B7D699-A39D-4A00-AD2E-EFC8B671874E”,“value”:{},“status”:0}
[debug] [BaseDriver] Event ‘orientationSet’ logged at 1490848149672 (09:59:09 GMT+0530 (IST))
[Appium] New XCUITestDriver session created successfully, session aee2481b-135d-4f01-9777-0620a6e854ae added to master session list
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1490848149675 (09:59:09 GMT+0530 (IST))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {“webStorageEnabled”:false,“locationContextEnabled”:false,“browserName”:"",“platform”:“MAC”,“javascriptEnabled”:true,“databaseEnabled”:false,“takesScreenshot”:true,“networkConnectionEnabled”:false,“automationName”:“XCUITest”,“app”:"/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app",“deviceName”:“iOS”,“platformName”:“iOS”,“udid”:“dea1eeecfba536a2a929ba1b11f7825b1da8c4f4”}
[HTTP] <-- POST /wd/hub/session 200 25345 ms - 467
[HTTP] --> POST /wd/hub/session/aee2481b-135d-4f01-9777-0620a6e854ae/url {“url”:“http://www.google.com”}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command ‘proxyReqRes’
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/aee2481b-135d-4f01-9777-0620a6e854ae/url] to [POST http://localhost:8100/session/A9B7D699-A39D-4A00-AD2E-EFC8B671874E/url] with body: {“url”:“http://www.google.com”}
[debug] [JSONWP Proxy] Got response with status 200: {“sessionId”:“A9B7D699-A39D-4A00-AD2E-EFC8B671874E”,“value”:“Failed to open http://www.google.com”,“status”:13}
[JSONWP Proxy] Replacing sessionId A9B7D699-A39D-4A00-AD2E-EFC8B671874E with aee2481b-135d-4f01-9777-0620a6e854ae
[HTTP] <-- POST /wd/hub/session/aee2481b-135d-4f01-9777-0620a6e854ae/url 200 67 ms - 111
Exception in thread “main” org.openqa.selenium.WebDriverException: Failed to open http://www.google.com
Command duration or timeout: 77 milliseconds
Build info: version: ‘2.42.2’, revision: ‘6a6995d’, time: ‘2014-06-03 17:42:30’
System info: host: ‘Lntinfitechs-mac-mini.local’, ip: ‘192.168.2.1’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.12.3’, java.version: ‘1.7.0_65’
Session ID: aee2481b-135d-4f01-9777-0620a6e854ae
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{automationName=XCUITest, app=/Users/lntinfotech/Desktop/SafariLauncherAfterUpdate/SafariLauncher.app, platform=MAC, databaseEnabled=false, javascriptEnabled=true, platformName=iOS, deviceName=iOS, browserName=, webStorageEnabled=false, networkConnectionEnabled=false, udid=dea1eeecfba536a2a929ba1b11f7825b1da8c4f4, locationContextEnabled=false, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:304)
at IOSWebTest.main(IOSWebTest.java:79)
[debug] [XCUITest] Connection to WDA timed out
[debug] [iProxy] recv failed: Operation not permitted
[BaseDriver] Shutting down because we waited 60 seconds for a command
[Appium] Closing session, cause was ‘New Command Timeout of 60 seconds expired. Try customizing the timeout using the ‘newCommandTimeout’ desired capability’
[Appium] Removing session aee2481b-135d-4f01-9777-0620a6e854ae from our master session list
[XCUITest] Shutting down sub-processes
[XCUITest] Shutting down xcodebuild process (pid 787)
[XCUITest] xcodebuild exited with code ‘null’ and signal ‘SIGTERM’
[XCUITest] Shutting down iproxy process (pid 786)
[debug] [XCUITest] iproxy exited with code ‘null’
[debug] [XCUITest] Found WDA derived data folder: ‘/Users/lntinfotech/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy’
[XCUITest] Setting ‘755’ permissions to ‘/Users/lntinfotech/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/Attachments’ folder
[debug] [iOSLog] Stopping iOS log capture