Forum Discussion

Valença's avatar
Valença
Occasional Contributor
6 years ago

Connected Application C# Keys method

Hello, 

 

I created a windows form application (connected application) and im trying to execute the code below:

Sys["Process"]("notepad")["Window"]("Notepad")["SetFocus"]();
Sys["Process"]("notepad")["Window"]("Notepad")["Window"]("Edit")["Click"](459, 242);
Sys["Process"]("notepad")["Window"]("Notepad")["Window"]("Edit")["Keys"]("123");

The first and second line run, but i got an exception when trying to send the Keys method.

 

The exception that is thrown by methods invoked through reflection.

 

How can i use Keys method on connnected application? 

If i execute the code on testcomplete, it runs all lines.

  • LinoTadros's avatar
    LinoTadros
    Community Hero

    I will need to see the rest of the code that connects on the Winforms side to be able to help more.

    I have 2 recommendations and hope they help:

    1- Connected Apps has been deprecated and obsolete for 6 years in TestComplete, the last Visual studio that was supported was VS 2013.  I would recommend you use TestLeft instead in Visual Studio.

    2- Using C#Script in TestComplete is a mistake, I don't recommend it and most people that used it confirm my observation

     

    Cheers

    -Lino

    • Valença's avatar
      Valença
      Occasional Contributor

      Thank for reply, but your answer is useless.

      I am using visual studio 2013.

       

      TestLeft has some bugs yet. I am wainting the develeopers fixes.

      Suport send me this mesage about TestLeft:

      "The developers have registered a bug for copying the identification, it should be fixed in one of the following releases"

       

      So, why cant i use Keys method on a edit by connected application?

       

      Sys["Process"]("notepad")["Window"]("Notepad")["Window"]("Edit")["Keys"]("123");

       

      • LinoTadros's avatar
        LinoTadros
        Community Hero

        My apology for my useless answer, I was just trying to help.

         

        If you can send me the code of the Winforms app, I promise to look at it.

        The setfocus and the Click are functions of the Edit Control in Windows and were found using .NET reflection at runtime by the compiler.  Keys on the other hand is a TestComplete function that runs against the Edit control.

        There are 3 different ways of connecting apps, I can't tell what you are doing by the 3 lines you sent, that is why I asked for more info.

         

        Thanks and sorry for wasting your time.

        -Lino