Delphi Vcl Controls Sometimes Don't Have the WinForms Name

Another suggested question ( Creating accessible user interface components in Delphi ) solves this problem, look there if you are looking for a solution.

I want to do automatic UI testing in a VCL application created using Delphi. I tried various tools, such as the assistant for the coded user interface in Visual Studio or “AutoIt”, but I always had an unpleasant problem: some controls simply do not have a name attached to them that can be extracted using these tools. I tried so many different tools, as well as WinSpy, to find out if this is a THERE property, and it is not.

Here is a small example:

Unit.pas:

type
TForm1 = class(TForm)
  Edit1: TEdit;
  Bt1: TButton;
end;

unit.dfm:

object Form1: TForm1
  ...
  object Edit1: TEdit
    Left = 8
    Top = 48
    Width = 121
    Height = 21
    TabOrder = 0
    Text = 'This is a Edit named Edit1'
  end
  object Bt1: TButton
    Left = 8
    Top = 8
    Width = 121
    Height = 25
    Caption = 'This is a button named Bt1'
    TabOrder = 1
  end
end

enter image description here

, , . - , ​​ ?

: , , , - . opimization, .

Embarcadero RAD Studio XE2

+3

All Articles