Jump to content

Recommended Posts

Posted

I have a button control as below screen.

Capture.JPG

This one I am able to suppress using below code in all the OS.

But on server 2008, sometimes the button highlighted in the image is not getting clicked and some times it is working.

I have cross checked the IDs when it is not working, but it is working only.

 

$win1 = "erwin Mart Configuration"


   $MartConfigWindow = _WinWaitActivate1($win1,"Database Details")
ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a6", $dbserver)
      ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a4", $dbname)
      ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a9", $dbuser)
      ControlSetText($MartConfigWindow, "", "WindowsForms10.EDIT.app.0.378734a8", $dbpassword)
      ;Button clicl logic
      $iControlClickStatus = ControlClick($MartConfigWindow, "", "[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:2]")
      
      ;If above button click fails, trying with mouse click on the control
      if ControlFocus($MartConfigWindow, "", "WindowsForms10.BUTTON.app.0.378734a2")=1 then ;sometimes above button fails in win server 2008,so this loop
         Send("{ENTER")
      EndIf

 

Any suggestion on how to resolve this.?

Posted

Are you sure "WindowsForms10.BUTTON.app.0.378734a" still exist ?

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

it's probably a timing issue. you need to wait for controls to exist before poking them. Just because the control's host form is loaded, does not meant that button is ready. try adding a 5 second delay. if that works, then you need to implement a way to wait for controls.

log4a.au3Fetching info...

WaitForControls.au3Fetching info...

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

Thank you very much for your inputs.

 

This is the windowinfo tool output.

Capture.JPG

It is showing  WindowsForms10.BUTTON.app.0.378734a

I already kept sleep of 40 seconds for every control, but still issue occurs.

 

 

Posted

Also, when you capture that button, can you post the Control Tab so we can see the actual button it captures? You will need all of that info.

My resources are limited. You must ask the right questions

 

Posted (edited)

So sorry! Wrong test tool! TestComplete

Sleep(5000)

I generally never use manual sleeps if at all possible.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

I feel your pain. Talking to WinForms and the newer WPF Forms is what drove me to use Visual Studio 2017 Enterprise Coded UI projects. They can record tests for ANYTHING and then you can maintain and add stuff at will. Other than that, you need to use the .NET CLR that was created by a user in these forums. Search for it.

My resources are limited. You must ask the right questions

 

Posted

It should work. make sure the Class is Constant. While Automating NET app is common get diferent classname.

Try to get the button position and use mouseclick.

 

Saludos

Posted
  On 10/27/2017 at 1:32 PM, Danyfirex said:

It should work. make sure the Class is Constant. While Automating NET app is common get diferent classname.

Try to get the button position and use mouseclick.

 

Saludos

Expand  

Can you suggest a sample..because I tried button click with mouse left click in the above code but same issue.

Posted
  On 10/27/2017 at 12:50 PM, Earthshine said:

I feel your pain. Talking to WinForms and the newer WPF Forms is what drove me to use Visual Studio 2017 Enterprise Coded UI projects. They can record tests for ANYTHING and then you can maintain and add stuff at will. Other than that, you need to use the .NET CLR that was created by a user in these forums. Search for it.

Expand  

Thanks @Earthshine, but is there any possibility to do in AutoIT itself instead of changing everything to CodedUI.

Posted

Google it. There are many examples over the forum.

 

Saludos

Posted (edited)

With Coded UI, you just record your tests!! and they run time after time. i would rather program in c# anyway so it's a no-brainer for me (you can use ANY .NET language, I love Python  as well for scripting). But with that link I posted above this comment, you should be able to talk to that tab control and the buttons.

 

thank you  Danyfirex !!! Loved your samples in that kit

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

The target app we are trying to automate is written in cpp. And it is working on different os but on server 2008. The issue occurs...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...