I’m trying to launch the appium server from eclipse using JAVA on a MAC. I’ve read through the tutorials and documentation here, but none of them worked for me. I tried changing the port #s and the paths, but nothing worked. Perhaps, some one can help me troubleshoot? Here’s the code I have so far:
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.42.1’, revision: ‘6a6995d’, time: ‘2014-06-21 03:12:34’
System info: host: ‘STammiraju’, ip: ‘10.143.8.39’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.10.5’, java.version: ‘1.7.0_79’
entry.getKey():“Driver info”
Where are you getting the Executor, DefaultExecutor, DefaultExecuteResultHandler, and CommandLine classes from? Executor isn’t the standard Java API defined Executor interface, since there is no setExitValue method defined in that particular interface. I’m currently assuming that this code spawns a child process that runs the command specified in the argument of the CommandLine constructor (why not use the ProcessBuilder class in the standard Java library?).
What is the code that sets up your Appium Driver (what are the lines involved that say new AndroidDriver(…) or new IOSDriver(…))?
What is the code that sets up your Appium Driver (what are the lines involved that say new AndroidDriver(…) or new IOSDriver(…))? I’m using appium’s DesiredCapabilities API that allows me to set up the iOS driver.
It’s possible that the Appium server wasn’t set up in a state ready for starting sessions by the time you called the Appium Driver constructor. Do you have some sort of wait code between spawning Appium and the constructor code?
My method to waiting was to poll “/wd/hub/status” at the address and port Appium is supposed to listen on until I received a valid response. At that point, I knew Appium was ready for starting a session; that’s when I would run the driver initialization code.
if u run this command in mac terminal
cd /usr/local/bin
./node
does this start node.js server
This is ideal way to start appium server, can u post error logs for this code
public void initializeServer() {
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/usr/local/bin/node"))
.withAppiumJS(
new File(
“/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js”))
.withIPAddress(“127.0.0.1”).usingPort(4723));
service.start();
if(service.isRunning())
System.out.println(“Appium server started successfully”);
}
I tried with this code it worked, using appium 1.3.7 dmg file and java client 3.2
public void initializeServer() {
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("/Applications/Appium.app/Contents/Resources/mode/bin/node"))
.withAppiumJS(
new File(
“/Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.js”))
.withIPAddress(“127.0.0.1”).usingPort(4723));
service.start();
if(service.isRunning())
System.out.println(“Appium server started successfully”);
}
Thank you @amitjaincoer191 Yes, I have node.js installed. And I have the following versions:
Appium: 1.4.13
Xcode: 7.0.1
OS X: 10.10.5 (EL Capitan)
Eclipse: Mars Release (4.5.0)
This is the error I’m getting with the code you’ve shared:
[36minfoe[39m: [debug] And launch timeouts (in ms): {“global”:90000}
e[36minfoe[39m: [debug] e[33m[INST STDERR] dyld: could not load inserted library ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib’ because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/submodue[39m
e[36minfoe[39m: [debug] e[33m[INST STDERR] les/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x104BA4000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib
e[39m
e[36minfoe[39m: [debug] e[90m[INSTSERVER] Instruments exited with code nulle[39m
e[36minfoe[39m: [debug] Killall instruments
[33mwarne[39m: Applications directory /Users/stammiraju/Library/Developer/CoreSimulator/Devices/442D41F0-0C60-4E0D-A3DF-EDC0F9EB06F4/data/Containers/Bundle/Application doesn’t exist. Have you run this simulator before?
e[36minfoe[39m: Couldn’t find app directories to delete. Probably it’s not installed
e[36minfoe[39m: [debug] Cleaning up appium session
e[31merrore[39m: Failed to start an Appium session, err was: Error: Instruments crashed on startup
e[36minfoe[39m: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:440:31)
at [object Object]. (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:353:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
e[36minfoe[39m: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Instruments crashed on startup)”,“origValue”:“Instruments crashed on startup”},“sessionId”:null}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 20804.904 ms - 182e[39m e[90me[39m
Since you have those logs now, that means that the Appium server is being launched now. Did you figure out what was the cause for Appium not launching previously?
Did you figure out what was the cause for Appium not launching previously? Just a restart of my mac Appium server is being launched but the simulator doesn’t. “Instruments crashed” failure. Any idea as to how to over come that?
No clue about how to deal with Instruments. My opinion on Instruments is that it’s incredibly flaky, inconsistent, and unreliable. Instruments is one of the best implementations of Murphy’s Law in my experience.
If a restart is what is needed to get Instruments working, there’s really no way around it, short of Apple open sourcing Xcode (and Instruments) for the community to improve the tool.