Invalid number of Arguments Error

Ask general questions here.
rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Invalid number of Arguments Error

Post by rastek » Fri Oct 28, 2016 9:50 pm

I just started mobile testing of my application on android device bu can not run or start a recording on my application from Ranorex. Both Run and Recording gives the Invalid number of Arguments error.

I instrumented and deployed compiled apk to device sucsessfully, the device connection is OK. Before I was able to run ranorex.RxBrowser through Ranorex but now gives as error for that too ..

I added a Run Mobile App step into my recording and give the name of application and it fails if I run it .. I also not sure about the name of the application, just wrote seen on the phone, is that correct ?

When I try to run my application, it gives 2 arguments error, however Run My App step has only one argument in the recording, what should I do ? and even if I can send second argument what is it , how can I know ?

Invalid number of Arguments. Expected 2 but got 1
Show/Hide Stacktrace
at Ranorex.Plugin.Mobile.XmlRpc.XmlRpcProtocolChannel.Call(MethodCall mc, TimeSpan responseTimeout) at Ranorex.Plugin.Mobile.Device.Channels.DeviceLogicChannel.StartApplication(AppInformation app) at Ranorex.Plugin.Mobile.Device.MobileDevice.StartApplication(AppInformation app) at Ranorex.Host.RunMobileApp(String deviceDisplayName, String appName) at test.test.Mobile.Run() in D:\Users\ravci\Documents\Ranorex\RanorexStudio Projects\test\test\Mobile.vb:line 80 at Ranorex.Core.Testing.TestSuiteModule.RunInternal(DataContext parentDataContext)

OS -> Windows 8.1
Ranorex -> 5.3
Android Device -> 5.2

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Invalid number of Arguments Error

Post by Martin » Mon Oct 31, 2016 8:07 am

Host.Local.RunMobileApp takes either 2 or 3 arguments:

1) string DeviceDisplayName
2) string AppName
3) bool ResetInitialState

The 2 required arguments are also shown on the recording/step display (.rxrec) "Device name" and "Startup arguments". You need to set them both with the correct process names.

I'm using Ranorex 6.1.0 though and it's always a good idea to keep your installation of Ranorex up to date as there have been many critical issues fixed from 5.3 to the current date.

rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Re: Invalid number of Arguments Error

Post by rastek » Mon Oct 31, 2016 11:11 pm

I am not calling through code bu from recording module and it only takes 2 arguments as seen in the screenshot.

However startup arguments is just one.
Attachments
RunMobileApp.png
RunMobileApp.png (63.07 KiB) Viewed 983 times

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Invalid number of Arguments Error

Post by Martin » Tue Nov 01, 2016 7:35 am

Yes i can see the difference. Quite odd. To be honest my suggestion would be to upgrade to the latest version of Ranorex. There are multiple reasons for this 1st being that it will most likely fix the issue you are having as for me with the latest Ranorex it seems fine. And there have probably been many Android related updates as well (not to talk about even the other fixed issues and support added) between 5.3 and the latest version. Also 5.3 might not be supported by Ranorex Staff anymore so you might not get feedback related to this issue. And again the reason for this is exactly that most likely the latest version will not have that issue.

Martin

rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Re: Invalid number of Arguments Error

Post by rastek » Tue Nov 01, 2016 10:29 am

I have server license problem with version 6.1

And my Android version is 5.1.1 actually, I made latest Software Upgraded with about ~400 MB file and I checked version is still 5.1.1 ??

When I run App from code as below , If I add an extra parameter compile gives error.

Host.Local.RunMobileApp("SM-G531F", "ranorex.RxBrowser", "")

However I think that even that version of Ranorex should do this basic stuff.
Last edited by rastek on Tue Nov 01, 2016 1:49 pm, edited 1 time in total.

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Invalid number of Arguments Error

Post by Martin » Tue Nov 01, 2016 10:58 am

rastek wrote:I have server license problem with version 6.1

And my Android version is 5.1 atually

When I run App from code as below , If I add an extra parameter compile gives error.

Host.Local.RunMobileApp("SM-G531F", "ranorex.RxBrowser", "")

However I think that even that version of Ranorex should do this basic stuff.
And what is the error it gives?

Atm the 3 argument method (according to Ranorex 6.1) should take a boolean as the last argument. You have specified a string element.

User avatar
N612
Posts: 62
Joined: Mon Jul 11, 2016 4:01 pm

Re: Invalid number of Arguments Error

Post by N612 » Tue Nov 01, 2016 6:23 pm

rastek wrote:I also not sure about the name of the application, just wrote seen on the phone, is that correct ?
While this is possible, it is not the best practice as you may not be typing the correct string. Did you properly instrument your application and deploy it through the instrumentation wizard? Do you see your application in the Ranorex Service App app's screen?

http://www.ranorex.com/support/user-gui ... ation.html
rastek wrote:Run My App step has only one argument
"Device Display Name" and "Startup Arguments" are the first two arguments. The third being "Restart App" (which may not be available in your outdated version) is optional.

http://www.ranorex.com/Documentation/Ra ... ileApp.htm

You can right click the action and "View Code" to see the backend code. 6.1.1 Looks like this:

Code: Select all

Report.Log(ReportLevel.Info, "Application", "Run mobile app 'myInstrumentedApp' on device 'nexus5_wifi'.", new RecordItemIndex(0));
Host.Local.RunMobileApp("nexus5_wifi", "myInstrumentedApp", true);
Delay.Milliseconds(3500);

rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Re: Invalid number of Arguments Error

Post by rastek » Wed Nov 02, 2016 9:41 am

I have instrumented file correctly actually (bcos other Ranorex version can record -but not play)

My code is
Host.Local.RunMobileApp("SM-G531F", "com.company.myapp")

and If I try this

Host.Local.RunMobileApp("SM-G531F", "com.company.myapp", true)


my problem is I can not instrument and start app in same Ranroex version... Ranorex version 5.3.2 does not start application , always give this error..

Invalid number of Arguments. Expected 2 but got 1
Show/Hide Stacktrace
at Ranorex.Plugin.Mobile.XmlRpc.XmlRpcProtocolChannel.Call(MethodCall mc, TimeSpan responseTimeout) at Ranorex.Plugin.Mobile.Device.Channels.DeviceLogicChannel.StartApplication(AppInformation app) at Ranorex.Plugin.Mobile.Device.MobileDevice.StartApplication(AppInformation app) at Ranorex.Host.RunMobileApp(String deviceDisplayName, String appName) at deneme.deneme.Mobile.Run() in D:\Users\ravci\Documents\Ranorex\RanorexStudio Projects\deneme\deneme\Mobile.vb:line 80 at Ranorex.Core.Testing.TestSuiteModule.RunInternal(DataContext parentDataContext)


My problem is instrumented version and service versions are not same, I need to solve one of them :(

I can not instrument with 5.4.5 but only with 5.3.2
I can not run mobile app with 5.3.2 but only with 5.3.2 !

rastek
Posts: 157
Joined: Wed Aug 06, 2014 12:00 pm

Re: Invalid number of Arguments Error

Post by rastek » Wed Nov 02, 2016 12:15 pm

I see that instrumented apk version and service version must be same, this should be mentioned in User Guide.

Now the problem is it starts recording in 5.3.2 but recording only general view with coordinates, any idea about that ?