MarketSquare / remoteswinglibrary

RemoteSwingLibrary
Apache License 2.0
31 stars 39 forks source link

java.lang.NullPointerException for PyCharm automation #99

Closed petr-kus closed 3 years ago

petr-kus commented 3 years ago

I don't know if I do something wrong but when I want to use remoteswinglibrary for PyCharme it just doesn't work and I get this error: . Select Main Window Selects the window that was opened first as current context. Start / End / Elapsed: 20210210 14:47:58.184 / 20210210 14:47:58.196 / 00:00:00.012 14:47:58.196 FAIL java.lang.NullPointerException: null 14:47:58.196 DEBUG java.lang.NullPointerException at org.robotframework.javalib.library.KeywordFactoryBasedLibrary.runKeyword(KeywordFactoryBasedLibrary.java:40) at org.robotframework.javalib.library.AnnotationLibrary.runKeyword(AnnotationLibrary.java:129) at org.robotframework.swing.SwingLibrary.runKeyword(SwingLibrary.java:127) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.robotframework.remoteserver.library.DynamicApiRemoteLibrary.runKeyword(DynamicApiRemoteLibrary.java:70) at org.robotframework.remoteserver.servlet.ServerMethods.run_keyword(ServerMethods.java:86) at org.robotframework.remoteserver.servlet.ServerMethods.run_keyword(ServerMethods.java:148) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.robotframework.remoteswinglibrary.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:115) at org.robotframework.remoteswinglibrary.apache.xmlrpc.server.ReflectiveXmlRpcHandler.execute(ReflectiveXmlRpcHandler.java:106) at org.robotframework.remoteswinglibrary.apache.xmlrpc.server.XmlRpcServerWorker.execute(XmlRpcServerWorker.java:46) at org.robotframework.remoteswinglibrary.apache.xmlrpc.server.XmlRpcServer.execute(XmlRpcServer.java:86) at org.robotframework.remoteswinglibrary.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:200) at org.robotframework.remoteswinglibrary.apache.xmlrpc.webserver.XmlRpcServletServer.execute(XmlRpcServletServer.java:112) at org.robotframework.remoteswinglibrary.apache.xmlrpc.webserver.XmlRpcServlet.doPost(XmlRpcServlet.java:196) at org.robotframework.remoteserver.servlet.RemoteServerServlet.doPost(RemoteServerServlet.java:122) at org.robotframework.remoteswinglibrary.javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.robotframework.remoteserver.servlet.RemoteServerServlet.service(RemoteServerServlet.java:102) at org.robotframework.remoteswinglibrary.javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:501) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) at java.base/java.lang.Thread.run(Thread.java:834)

when I try the same thing with JEdit it passed. I have a theory that there is a problem with SplashScreen because the connection is created without issues till a moment I just want something with UI objects. And also I already had a problem with the splash screen in PyCharm for PyWinAuto.

I already tried more versions of RemoteSwingLibrary, JDK (8-15) and more stations without success to find a workaround.

PyCharm version is 2019.2.3 RemoteSwingLibrary 2.2.8 (I tried 2.2.4 and 2.2.7 almost the same result.)

The test case that I am trying is test2 [tags] test2 Start Application PyCharm C:/Program Files/JetBrains/PyCharm Community Edition 2019.2.3/bin/pycharm64.exe Log Java System Properties Sleep 15 Select Main Window Get Current Context List Dialogs Select Window regexp=.*PyCharm.* Get Window Size myAlias List Windows Select Window regexp=.*PyCharm.* [teardown] System Exit exit_code=1

The full log and results are in the attachment.

Could you fix or give me a hint? Thank you :-) logs.zip

cristii006 commented 3 years ago

Hello @dibi-x,

Unfortunately what are you trying to achieve is not possible as I don't think PyCharm is a Java Swing application. From what I've seen PyCharm is written in Python and Java, but I don't think the GUI use Swing. When you tried to test jEdit, it worked because I think jEdit is a Swing application, but this doesn't apply for PyCharm. I think you might need to find another RF library that is able to do what you want, but I am not sure what you can use.

Best regards, Cristi

cristii006 commented 3 years ago

Due to inactivity this issue will be closed. It can be reopened later if necessary.

petr-kus commented 3 years ago

The framework of Pycham isn't clear topic. In the documentation in JetBrains, they use the term "Swing UI". https://plugins.jetbrains.com/docs/intellij/testing-plugins.html also there are few discussions about this at StackOverflow. I can probably use/wrap "Official way". But maybe there is missing support on your site.

petr-kus commented 3 years ago

I checked their source code. It seems to me as swing absolutely... link1 ; link2 ; link3 => I think this is for reopen.

rticau commented 3 years ago

Hi @dibi-x

It is not clear from the info you provided if this is an issue in RSL or just something specific to PyCharm startup.

Unfortunately we do not have the time to allocate to investigate this issue further, as our priority is in other projects and we cannot focus on RSL right now. I would suggest to try to get some help in Slack or RF forum, maybe you will be lucky to find some suggestions there.

If you are able to get more insights into this issue please come back with updates and I will reopen this issue in case we suspect a bug in RSL.