c# - Find process and attach to ProcessStartInfo to method -
i trying manipulate windows' calculator. if programme finds instance (which does), needs provide process' startinfo teststack's white framework uiautomation. however, maintain getting next exception:
system.argumentexception unhandled hresult=-0 message=the path not of legal form. source=mscorlib stacktrace: @ system.io.path.normalizepath(string path, boolean fullcheck, int32 maxpathlength, boolean expandshortpaths) @ system.io.path.getfullpathinternal(string path) @ system.io.fileinfo.init(string filename, boolean checkhost) @ system.io.fileinfo..ctor(string filename) @ teststack.white.application.launch(processstartinfo processstartinfo) in c:\teamcity\buildagent\work\89a20b30302799e\src\teststack.white\application.cs:line 60 @ teststack.white.application.attachorlaunch(processstartinfo processstartinfo) in c:\teamcity\buildagent\work\89a20b30302799e\src\teststack.white\application.cs:line 144 @ test_with_gui.tests.uiautomation.test() in c:\users\blah\test gui\test gui\tests\uiautomation.cs:line 24 @ test_with_gui.mainwindow.testing_component7() in c:\users\blah\test gui\test gui\mainwindow.xaml.cs:line 257 @ system.threading.threadhelper.threadstart_context(object state) @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state) @ system.threading.threadhelper.threadstart() innerexception
at found[0].startinfo
next lines of code
process[] found = process.getprocessesbyname("calc"); if (found.length > 0) { using (var app = teststack.white.application.attachorlaunch(found[0].startinfo)) { using (var win = app.getwindow(searchcriteria.bytext("calculator"), initializeoption.nocache)) { manipulation(); } } }
the calculator process running. (accessories > calculator)
c# exception processstartinfo white
No comments:
Post a Comment