Getting Error when try to connect real device in IOS using Appium - ios

I am trying to automate ios mobile application. I have configure all classpath , installed appium , eclipse and have done everything. But now when I run my program , I am getting error :
A new session could not be created. (Original error: Could not initialize
ideviceinstaller; make sure it is installed and works on your system)(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.34 seconds
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'www.example.com', ip: 'xxx.xxx.x.xxx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.4', java.version: '1.8.0_45'
Driver info: io.appium.java_client.ios.IOSDriver
My code is :
File path = new File("/Users/test/Desktop/myapp.ipa");
// Setting capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("device", "iPhone 6+");
capabilities.setCapability("udid", "xxxxxxx");
capabilities.setCapability("deviceName","iPhone 6+");
capabilities.setCapability("platformVersion", "8.4.1");
capabilities.setCapability("app", "settings");
driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub/"), capabilities)
Note : I have tried all these - https://goo.gl/rf4KJV solutions but no luck.

Please install ideviceinstaller properly and set the path for ideviceinstaller
Use the following command to install ideviceinstaller brew install --HEAD ideviceinstaller
$ brew install --HEAD ideviceinstaller
if ideviceinstaller is already install. then unlink it and link it back using following commands
$ brew unlink ideviceinstaller
$ brew link ideviceinstaller

Related

Unable to see appium-webdriveragent folder when install Appium 2.0

I have installed Appium 2.0 using command line but unable to see the appium-webdriveragent folder under /usr/local/lib/node_modules/appium/node_modules/ path (no folder found which is starts with appium).
Theses are the following commands I ran:
npm install -g appium#next
brew install Carthage
npm install -g appium-doctor
appium --base-path /wd/hub
appium driver install xcuitest
appium plugin install images
appium plugin install execute-driver
appium plugin install relaxed-caps
This is the appium version:
~ % appium -v
2.0.0-beta.46
This is the driver installed location:
~ % npm ls -g appium-webdriveragent
/usr/local/lib
└── (empty)
I am using Xcode:
Version 14.1 (14B47b)
This is the execution failure log:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
xcodebuild error message:
. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Host info: host: 'L0057s-MacBook-Pro.local', ip: 'fe80:0:0:0:1863:fbc8:e2f5:1313%en0'
Build info: version: '4.5.0', revision: 'fe167b119a'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.5.1', java.version: '18.0.1.1'
Driver info: io.appium.java_client.AppiumDriver
Command: [null, newSession {capabilities=[{appium:appName=XXXX APP, appium:automationName=XCUITest, browserName=, appium:deviceName=iPhone 6s, appium:newCommandTimeout=60, platformName=IOS, appium:platformVersion=15.7.1, appium:udid=0ee9ce6c7e262203d06348ed55de4e747cfaab75, appium:usePrebuiltWDA=true}], desiredCapabilities=Capabilities {appName: XXXX APP, automationName: XCUITest, browserName: , deviceName: iPhone 6s, newCommandTimeout: 60, platformName: IOS, platformVersion: 15.7.1, udid: XXXXXXXX1234..., usePrebuiltWDA: true}}]
Capabilities {}
have followed https://github.com/appium/appium
You could try this fix.
For me it didn't work and I had to go back to xcode 13.4.1 to have it working again...
I tried as well with Appium2 (2.0.0-beta.46) but, unfortunately, I had to go back to 1.22.3 and downgraded Xcode from 14.1 to 13.4.1
Try installing XCUITest via:
appium driver install xcuitest or appium driver update xcuitest
appium-webdriveragent folder is available in user's home directory as .appium or can be located via
echo "$(dirname "$(find "$HOME/.appium" -name WebDriverAgent.xcodeproj)")"

BrowserStack - Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure

In my local Jenkins Docker container, I could run my test plan without any issues .
Even without giving
However, in my office Jenkins server, I setup with that as per the https://www.browserstack.com/docs/automate/selenium/jenkins#configuring-browserstack-credentials
Yet I get this error.
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: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'hidden', ip: 'hidden', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.15.2.el7.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: RemoteWebDriver
at com.sam.browserstack.BrowserStackInitiation.setUp(BrowserStackInitiation.java:78)
Caused by: java.net.SocketTimeoutException: connect timed out
at com.sam.browserstack.BrowserStackInitiation.setUp(BrowserStackInitiation.java:78)
My build command is as per below.
export M2_HOME=/var/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/Maven3
export PATH=$PATH:$M2_HOME/bin
mvn --version
cd CommonPagesStorage
mvn clean install -DskipTests
cd ..
cd AutomationFrameworkDemo
mvn clean test -Dbrowser="${Browser}" -Dbrowser_version="${browser_version}" -Dos_version="10" -Dos="Windows" -Dlocalrun="false" -Dtestxml=src/test/TestSuites/${TestPlanName}
I also tried adding below code as exports but no avail.
export http_proxy="http://proxy-dev.can.myorg.com:8080"
export https_proxy="http://proxy-dev.can.myorg.com:8080"
export NO_PROXY=123.345.145.345,.can.myorg.com,localhost,200.0.0.2
I got the url whitelisted from netwrok team, also below lines of code were needed too.
https://username:password#hub-cloud.browserstack.com/wd/hub
(Since I use free style project, to get M2_HOME, I created a maven project with just mvn --version as a shell command and got the value from output console)
export M2_HOME=/opt/software/apache-maven-3.6.3
export PATH=$PATH:$M2_HOME/bin
export http_proxy="http://proxy-dev.aws.skynet.com:8080"
export https_proxy="http://proxy-dev.aws.skynet.com:8080"
export NO_PROXY=777.777.777.777,.aws.skynet.com,localhost,127.0.0.1
mvn --version
cd CommonPagesStorage
mvn clean install -DskipTests
cd ..
cd AutomationFrameworkDemo
mvn clean test -Dhttp.proxyHost=proxy-dev.aws.skynet.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy-dev.aws.skynet.com -Dhttps.proxyPort=8080 -Dbrowser="${Browser}" -Dbrowser_version="${browser_version}" -Dos_version="10" -Dos="Windows" -Dlocalrun="false" -Dtestxml=src/test/TestSuites/${TestPlanName}

Failed to start Chromedriver session: A new session could not be created. Details: session not created: Chrome version must be between 71 and 75

I am trying to launch chrome on my Android mobile which has chrome version: 76.0.3809.89
When I run my Java program, I get below error:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
Chrome version on the device: Chrome/76.0.3809.89
Visit 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md' to troubleshoot the problem.
Failed to start Chromedriver session: A new session could not be created. Details: session not created: Chrome version must be between 71 and 75
**(Driver info: chromedriver=2.46.628402** (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'abc', ip: '10.0.1.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
**Chrome version on the device: Chrome/76.0.3809.89**
Visit 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md' to troubleshoot the problem.
I have below questions:
From where it is picking chromedriver=2.46.628402 as it mentions in the log ?
How to fix this error?
My code:
package browserTest;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class ChromeTest {
public static void main(String args[]) {
//Set the Desired Capabilities
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "My Android Mobile");
cap.setCapability("udid", "521010f9ee4fb499");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "7.0");
cap.setCapability("browserName", "Chrome");
cap.setCapability("noReset", true);
//Instantiate Appium Driver
AppiumDriver<MobileElement> driver = null;
try {
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
}catch (MalformedURLException e) {
e.getMessage();
}
//Open URL in Chrome browser
driver.get("http://www.google.com");
}
}
i'm using Windows and AppiumServer with nodejs
you can download at https://chromedriver.storage.googleapis.com/index.html
matching chrome driver version
and change chrome driver at
C:\Users\{username}\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win
with this command chromedriver.exe -version
you can check version like this
C:\Users\{username}\AppData\Roaming\npm\node_modules\appium\node_modules\appiu
m-chromedriver\chromedriver\win>chromedriver.exe -version
ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1)
C:\Users\{username}\AppData\Roaming\npm\node_modules\appium\node_modules\appiu
m-chromedriver\chromedriver\win>chromedriver.exe -version
ChromeDriver 76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-
heads/3809#{#83})
You need the correct chromedriver which can handle Chrome 76 on your device.
You can try to set in manually with appium see here:
npm install appium --chromedriver_version="76.0.3809.68"
Another option that should work would be to use the WebDriverManager.
It automatically downloads the correct driver and sets the capabilities accordingly.
Just add it to your project.
For example if you have a gradle project add following line to your build.gradle:
compile group: 'io.github.bonigarcia', name: 'webdrivermanager',
version: '3.6.2'
Then you need to set the chromedriver in your driver capabilities:
WebDriverManager.chromedriver().setup();
cap.setCapability("chromedriverExecutable", WebDriverManager.chromedriver().getBinaryPath());

ideviceinstaller -l won't show the app list on the iPhone

I'm using Appium to test apps on the real device, and I got an strange error, here is the log
[debug] [iOS] App is not installed. Will try to install.
[MJSONWP] Encountered internal error running command: Error: Installing com.Sosgps.BiaoZhun4 failed
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/node-idevice/main.js:159:6
at ChildProcess.exithandler (child_process.js:193:7)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at maybeClose (internal/child_process.js:850:16)
at Socket. (internal/child_process.js:323:11)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at Pipe._onclose (net.js:475:12)
[HTTP] <-- POST /wd/hub/session 500 1535 ms - 175
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
then I use "ideviceinstaller -l" command to show the app list on the iPhone and I got "Could not connect to lockdownd. Exiting.". Then I open the iTunes and found that the app list is empty
Thanks for your time
PS: I have reinstall ideviceinstaller and Xcode and restart my mac and iPhone several times
Get the latest libimobiledevice, which has a fix for this particular issue:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller
First step: you need to change Appium setting on dashboard,don't select Full Reset button, and insert your Application path to AppPath context.
Second: Check your real Phone whether it has been installed with App or not, if you have then Uninstall it. If not then leave it as it is.

Macports issue setting up RVM

Just setting up rails and RVM on a new laptop and i'm getting this error when running
Error running 'requirements_osx_port_update_system ruby-2.0.0-p247',
please read /Users/#####/.rvm/log/1380821805_ruby-2.0.0-p247/update_system.log
Requirements installation failed with status: 1.
When running this
sudo rvm install ruby
Which produces this code.
[2013-10-03 13:36:45] requirements_osx_port_update_system
requirements_osx_port_update_system ()
{
__rvm_try_sudo port -dv selfupdate || return $?
}
current path: /Users/matthewpetitt
command(2): requirements_osx_port_update_system ruby-2.0.0-p247
DEBUG: Copying /Users/matthewpetitt/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
---> Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Operation timed out (60)
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync- 42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
while executing
"macports::selfupdate [array get global_options] base_updated"
Error: Error synchronizing MacPorts sources: command execution failed
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets
Error: /Users/matthewpetitt/.rvm/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed
I already have Xcode and Xcode command line tools installed. Anyone fixed something like this before.
Realized that it was just some network configuration at work that must have been blocking the ports. Check your network permissions or try a different network.
You need to make sure this command can be run first:
sudo port -dv selfupdate
This can be temporary network problem - if it is not follow the displayed instructions.

Resources