Automate a legacy Java application from C# -
i have old legacy java application i'd automate c#. problem don't have source code of application , programmer has long since left company. 'decompile' .jar file i'm no java programmer either, , don't think having access source code (without comments) me further.
so far managed (kinda successfully) automate application's login dialog, using following code (i'm polling in loop because there might more 1 instance of java app):
while (true) { var processes = process.getprocesses().where(p => p.mainwindowtitle.equals("title of java login window")); foreach (var process in processes) { var handle = process.mainwindowhandle; setforegroundwindow(handle); await task.delay(500); sendkeys.sendwait("the password"); sendkeys.sendwait("{tab}"); sendkeys.sendwait("the username"); sendkeys.sendwait("{enter}"); await task.delay(3000); } await task.delay(500); }
now problem i'm unable grab contents of java window. example, there might problem login, wrong user or password. wan't check java window login failure messages.
is there way access actual content (text) of java window?
also, instances of java application share same pid, because in reality it's 1 java.exe process running applications. there way differentiate between applications? can't done using pid ...
it helluva easy decompile jar file. download (currently) used java decompiler, click file -> open , open jar file. can browse code in main window, , copy , paste actual files.
Comments
Post a Comment