Parameters were incorrect when running Selenium? - eclipse

I'm testing my app on mac with real ios device. When i run the scripts it says following error in Eclipse IDE,
org.openqa.selenium.SessionNotCreatedException: Unable to create new
remote session. desired capabilities = Capabilities
[{app=/Users//Downloads/XXX.ipa,
platformVersion=10.2.1, platformName=iOS, deviceName=Mr.x'S iPod touch,
UDID=*****}], required capabilities =
Capabilities [{}]
Then i checked the logs in appium it shows,
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were
incorrect. We wanted {"required":["desiredCapabilities"],"optional":
["requiredCapabilities","sessionId","id"]} and you sent [
"desiredCapabilities" , "requiredCapabilities", "capabilities",
"alwaysMatch","firstMatch"]
What should i do to fix this, Can anyone help me to resolve this.

Yes, you need xcode to access iOS native app.
Desired capabilities to be used:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "9.3");
capabilities.setCapability("deviceOrientation", "portrait");
capabilities.setCapability("browserName", "Safari");
capabilities.setCapability("autoWebview", "true");
capabilities.setCapability("automationName", "XCUITest");
capabilities.setCapability("deviceName", "iphone");
capabilities.setCapability("autoAcceptAlerts",true);
capabilities.setCapability("udid", UDID);
capabilities.setCapability("xcodeConfigFile", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig");
capabilities.setCapability("realDeviceLogger","/usr/local/lib/node_modules/deviceconsole");

Related

How can I get android id using ADB and within Unity application?

I need to get the AndroidID using ADB and inside the unity application check if it's the same device using the AndroidID.
With this command, using ADB I have the AndroidID:
adb shell settings get secure android_id
>> a9822db857e4****
And inside the unity application, I'm using this code:
AndroidJavaClass clsUnity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject objActivity = clsUnity.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject objResolver = objActivity.Call<AndroidJavaObject>("getContentResolver");
AndroidJavaClass clsSecure = new AndroidJavaClass("android.provider.Settings$Secure");
string android_id = clsSecure.CallStatic<string>("getString", objResolver, "android_id");
>> android_id = 98ff3a034b16****
You may notice that the IDs are different.
Does anyone have a solution for this?
How can I get that same identifier using ADB and in unity ?
If your device runs Android version > Android 8.0 (API level 26), the ANDROID_ID string is unique to each app (more precisely, to each app-signing key - so more like unique to all your apps you signed with the same key). You can check out all the changes related to ANDROID_ID here.
If you are running Android version < 8.0, you might have multiple users and they will have separate ids - maybe you are getting root users' id via ADB and the whatever-user-launched-your-app id from code? (See here).

It is impossible to create a new session because 'createSession' which takes HttpClient,

org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
I am getting this error randomly i want to know the route cause for this issue in IOS
There are multiple reason behind this issue. There are multiple ways to resolve this issues, depending upon, where these issues are coming from.
1)One issue which occur to me was DesireCapabilities.setCapability() key/value was not correct type. I have resolved this issue by just
DesiredCapabilities.setCapability("capabilities_variable","capabilities_value");
setCapability("appWaitDuration", "600000"); here 600000 was String instead of long or int
Check your setCapability type whether it String/int/long.
2) Check USB Connection is Laptop or Computer, if not connected than same issue.
3) ADB Server might be problem. So adb kill-server and adb start-server
4) Try to change USB and try it out.
5) Sometimes, it might be a proxy issue(Laptop/Desktop may have some proxy setup
in organization, since for Desktop/Laptops are connected with Mobile via TCP/IP Connection).
6) Sometimes, there might be permission required to access PORT (sudo ufw allow portnumber (UBUNTU SYSTEM))
7) Environment variable required Android_SDK_Home and Android Platform Tools path
**> Solution 1st**
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "xyz");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("platformName", Platform.ANDROID);
capabilities.setCapability("appPackage", "com.hp.HPSupportAssistant");
capabilities.setCapability("appActivity", "com.hp.HPSupportAssistant.MainActivity");
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 6000); capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,true);
//desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
**Here comment below line and then run it will work**
desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
**solution 2nd Or keep above line in desired capabilities but before that do
run 3 cmd on cmd promt**
adb shell pm list packages -f > D://t.txt
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server
desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);

Gettng Error WLClient onInvokeProcedureFailure:userInfo in WLClient.m

We are getting below error while calling a simple HTTP Adaptor through iOS Apple Watch OS1. We have mobilefirst 6.3 with WorklightAPI iOS deployed on server.
[WL_CLIENT] -[WLClient onInvokeProcedureFailure:userInfo:] in WLClient.m
Status: 0
InvocationResult: (null)
InvocationContext: (null)
Error code: 3
Error message: Procedure invocation error.
It runs fine when we run it on development server. Only difference we see is on Test server TLSv1.2 is enabled while on development it is not.
We defined ATS --> Allow Arbitrary Loads = YES in info.plist
but we are still getting an error.
Any Advice ?
As mentioned multiple times, Apple Watch is not supported. And in any case, since this is Watch OS 1 it means you invoke the code from the "parent" iOS app, no? In which case this was answered in your other question: https://stackoverflow.com/questions/34206002/there-is-no-registered-challenge-handler

How to configure the Genymotion emulator to the appium?

Through eclipse I have configured the Genymotion path & also I have downloaded the virtual devices in the Genymotion.
In Appium, those downloaded virtual devices are visible in the"Launch Device" dropdown menu. Then I set the apk path & try to start the Appium 1.3.4.1.
By that time I am getting an error message like
Starting Node Server
usage: main.js [-h] [-v] [--shell]
main.js: error: Unrecognized arguments: Nexus 5 - 4.4.4 - API 19 - 1080x1920.
[--localizable-strings-dir LOCALIZABLESTRINGSDIR] [--app APP]
[--ipa IPA] [-U UDID] [-a ADDRESS] [-p PORT]
[-ca CALLBACKADDRESS] [-cp CALLBACKPORT] [-bp BOOTSTRAPPORT]
[-k] [-r BACKENDRETRIES] [--session-override] [--full-reset]
[--no-reset] [-l] [-lt LAUNCHTIMEOUT] [-g LOG]
[--log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[--log-timestamp] [--local-timezone] [--log-no-colors]
[-G WEBHOOK] [--native-instruments-lib]
[--app-pkg ANDROIDPACKAGE] [--app-activity ANDROIDACTIVITY]
[--app-wait-package ANDROIDWAITPACKAGE]
[--app-wait-activity ANDROIDWAITACTIVITY]
[--android-coverage ANDROIDCOVERAGE] [--avd AVD]
[--avd-args AVDARGS]
[--device-ready-timeout ANDROIDDEVICEREADYTIMEOUT] [--safari]
[--device-name DEVICENAME] [--platform-name PLATFORMNAME]
[--platform-version PLATFORMVERSION]
[--automation-name AUTOMATIONNAME] [--browser-name BROWSERNAME]
[--default-device] [--force-iphone] [--force-ipad]
[--language LANGUAGE] [--locale LOCALE]
[--calendar-format CALENDARFORMAT] [--orientation ORIENTATION]
[--tracetemplate AUTOMATIONTRACETEMPLATEPATH] [--show-sim-log]
[--show-ios-log] [--nodeconfig NODECONFIG] [-ra ROBOTADDRESS]
[-rp ROBOTPORT] [--selendroid-port SELENDROIDPORT]
[--chromedriver-port CHROMEDRIVERPORT]
[--chromedriver-executable CHROMEDRIVEREXECUTABLE]
[--use-keystore] [--keystore-path KEYSTOREPATH]
[--keystore-password KEYSTOREPASSWORD] [--key-alias KEYALIAS]
[--key-password KEYPASSWORD] [--show-config] [--no-perms-check]
[--command-timeout DEFAULTCOMMANDTIMEOUT] [--keep-keychains]
[--strict-caps] [--isolate-sim-device] [--tmp TMPDIR]
[--trace-dir TRACEDIR] [--intent-action INTENTACTION]
[--intent-category INTENTCATEGORY] [--intent-flags INTENTFLAGS]
[--intent-args OPTIONALINTENTARGUMENTS]
Node Server Process Ended
When I try to run with normal emulator in Android SDK it works well.
But I want to run it with Genymotion emulator. How to do? I'm stuck up here.
My questions are:
Whether the additional emulator will work in appium windows or not?
What I need to give in the "Argument" field under appium?
The following code works for the above question.
static String deviceName = "Google Nexus 5 - 4.4.4 - API 19 - 1080x1920";
public static void main(String[] args) throws InterruptedException, ExecuteException, IOException {
DesiredCapabilities capabilities = new DesiredCapabilities();
DefaultExecutor executor = new DefaultExecutor();
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
CommandLine launchEmul = new CommandLine("C:/Program Files/Genymobile/Genymotion/player");
launchEmul.addArgument("--vm-name");
launchEmul.addArgument("\""+deviceName+"\"");
executor.setExitValue(1);
executor.execute(launchEmul, resultHandler);
Thread.sleep(40);
capabilities.setCapability("deviceName","Google Nexus 5 - 4.4.4 API 19 - 1080x1920");
capabilities.setCapability("platformVersion", "4.3");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app","D:/SOFTWARES/Apks/GOA.apk");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
System.out.println("SetUp is successful and Appium Driver is launched successfully");
}
Recently i i've used genymotion and appium and worked fine
1-i've installed appium(i've tried windows and console version succesfully)
2-i've installed genymotion and created a virtual device in it
3-launched virtual device from genymotion
4-in my test, when i defined driver capabilities, i didnt identified a specific virtual device, so, appium try to identify any active device(virtual or not)
try that and let me know if worked to help in anything i could

Communicating with DB through SSH in GWT app (using RPC)

I am trying to write a GWT back-end using the RPC model for java servlets.
Is it possible to ssh tunnel within an RPC in order to communicate with a remote sql database?
The code I try to execute is below, using Jsch. The error occurs on "session.connect();"
String host="xxxxx.xxx.edu";
String user="username";
String password="password";
Session session= null;
try{
//Set StrictHostKeyChecking property to no to avoid UnknownHostKey issue
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
JSch jsch = new JSch();
session=jsch.getSession(user, host, 22);
session.setPassword(password);
session.setConfig(config);
session.connect();
}
The runtime error I get on the 'session.connect()' line is as follows: (scroll right to see whole error)
com.jcraft.jsch.JSchException: java.security.AccessControlException: access denied (java.net.SocketPermission xxxxx.xxx.edu resolve)
at com.jcraft.jsch.Util.createSocket(Util.java:341)
at com.jcraft.jsch.Session.connect(Session.java:194)
at com.jcraft.jsch.Session.connect(Session.java:162)
at com.front.server.GameServiceImpl.createGame(GameServiceImpl.java:39)
The frustrating part about this is that I copied/pasted the exact same code into a simple java program and it works. So I know the code is correct; obviously the jetty server which GWT creates for local testing has a problem executing the code. What else can I do / what should I be doing in this situation with GWT? Shouldn't the back-end of a GWT application have the capacity to ssh??
I suggest you try running your gwt app with a different web container (Tomcat, JBoss). You can still make use of debugging functionality by running the hosted mode with the -noserver flag.
See here