Forum Discussion

Test56's avatar
Test56
Contributor
13 years ago

Fails to clickTextbox of Edit class when disabled

Hello,



We are using TC 8.2 to write scripts for automating our test plan. We came across a scenario where we need to click on the textbox of Edit Class which is disabled . The testObject.Click failed when executed. When i tried to record, it did properly whereas when i tried running that recorded script it failed telling the window was disabled. Can we do anything about this ? Any help will be appreciated.

1 Reply

  • Hello Rajat,

    TestComplete cannot simulate user actions over disabled controls.

    As a workaround, you can modify your recorded script in the following way: obtain the coordinates of the disabled text box relatively to its parent control and simulate a click over the parent control at the specified point.

    For example, the following script obtains the coordinates of the text box control relatively to its parent form control and them simulates a click at those coordinates:

    ' Obtains the text box

    Set edit = Aliases.SampleApp.mainForm.textBox

    ' Obtains the parent control that holds the text box

    Set parent = edit.Parent

    ' Determines the coordinates of the text box center relatively to the text box's parent control

    x = edit.Left + edit.Width / 2

    y = edit.Top + edit.Height / 2

    ' Simulates a click

    Call parent.Click(x, y)


    Please let us know if this information does not help or if you have any additional questions.

    Thank you.