Ranorex - 不能调用带有参数但返回值为WITH的java方法

时间:2016-02-04 09:41:05

标签: java c# automation overloading ranorex

我试图用Ranorex测试Java应用程序。

[Thread 56] Unloading (count: 0) [Thread 56] Added PackagingTask behind queue of : 0 [Thread 56] Task added Umbraco.Courier.Core.Tasks.PackagingTask [Thread 25] Starting PackagingTask with id: dbdaaa27-12f0-453e-a272-ee86f42ee320 [Thread 25] Opening session: 5d218615-ecf8-430d-8853-bf7b7a27299a [Thread 25] Opening session to http://www.adamanthony.co.uk [Thread 25] Document types: SkillItem hash-mismatch (local/remote) d1572093dd52efbce27132025a9b70f7 / 736e152936c2d2fbcf35e3f28c23b3bb [Thread 25] Disposing: True [Thread 25] Closing session: 5d218615-ecf8-430d-8853-bf7b7a27299a [Thread 25] Closing session, UseGlobalSession: False, key: 5d218615-ecf8-430d-8853-bf7b7a27299a [Thread 25] Closing session, IsInWebContext: False [Thread 25] Disposing: True [Thread 25] Unloading (count: 0) [Thread 25] Completed PackagingTask with id: dbdaaa27-12f0-453e-a272-ee86f42ee320 [Thread 42] Unloading (count: 0) [Thread 42] Added ExtractionTask behind queue of : 0 [Thread 42] Task added Umbraco.Courier.Core.Tasks.ExtractionTask [Thread 22] Starting ExtractionTask with id: cba12ffe-c730-4e38-838d-2c278463332b [Thread 22] Running PopulateGraph [Thread 22] Finished PopulateGraph (took 2ms) [Thread 22] Adding event DeleteContentAndMedia To Queue: DeploymentComplete for session: 8d502ccd-e4ea-49b1-a9b3-4159ea5a8fa3 [Thread 22] Starting extraction [Thread 22] Opens database session [Thread 22] Opening session to http://www.adamanthony.co.uk [Thread 22] Transfering pre-extraction files [Thread 22] Running ExtractReadyRevisionBatch [Thread 22] Extracting batch of 1 items [Thread 22] Extracting: AdamAnthony - Umbraco.Courier.Core.DependencyGraph+GraphNode [Thread 22] Finished ExtractItem (took 230ms) [Thread 22] Finished ExtractReadyRevisionBatch (took 230ms) [Thread 22] There was a problem with extracting database information for the item: Name:AdamAnthony | Id:Adamanthony | Provider:Document types System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: A call to SetContextId must occur before getting/setting a context [Thread 22] Rolling back changes due to errors [Thread 22] Disposing: True [Thread 22] Closing session called but there is no session open: 8d502ccd-e4ea-49b1-a9b3-4159ea5a8fa3 [Thread 22] Unloading (count: 1) 课内,我有两种方法:

Ranorex.JavaElement

这个重载不允许调用没有参数的方法,但是带有返回值,因为重载机制没有考虑返回值,所以当我调用没有参数的方法时它总是选择第一个选项。

Ranorex中有没有其他方法可以调用没有参数但带有返回值的Java方法?

由于

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,以下代码对我有用。

 Object[] param = new Object[0];     
 JavaElement myElement =  repo.Java.Self.As<JavaElement>();
 var returnVal = myElement.InvokeMethod("myMethodToInvoke", param);