Forum Discussion
Thanks for the help. When I record the test I get the following with no SetText command.
Sub Test1
Dim sensorWorks
Dim sensorWorksMain
Dim manageJob
Dim textBox
Set sensorWorks = Aliases.SensorWorks
Set sensorWorksMain = sensorWorks.SensorWorksMain
Call sensorWorksMain.MainMenu.Click("Project|New")
sensorWorks.dlgNew.btnOpen.ClickButton
Set manageJob = sensorWorks.ManageJob
Set textBox = manageJob.textBoxJobNumber
Call textBox.Click(18, 7)
Call textBox.Click(44, 10)
Call manageJob.label2.Click(38, 18)
manageJob.buttonOk.ClickButton
Call sensorWorksMain.MainMenu.Click("Project|Close")
End Sub
I modified the script to add the two SetText items shown below and it works perfectly.
Sub Test1
Dim sensorWorks
Dim sensorWorksMain
Dim manageJob
Dim textBox
Set sensorWorks = Aliases.SensorWorks
Set sensorWorksMain = sensorWorks.SensorWorksMain
Call sensorWorksMain.MainMenu.Click("Project|New")
SensorWorks.dlgNew.ComboBoxEx32.SetText("test4.proj")
sensorWorks.dlgNew.btnOpen.ClickButton
Set manageJob = sensorWorks.ManageJob
Set textBox = manageJob.textBoxJobNumber
manageJob.textBoxJobNumber.SetText("123456")
Call textBox.Click(18, 7)
Call textBox.Click(44, 10)
Call manageJob.label2.Click(38, 18)
manageJob.buttonOk.ClickButton
Call sensorWorksMain.MainMenu.Click("Project|Close")
End Sub
If you use Object Spy on one of those fields and look in the Methods tab, do you see SetText in the list?
- dmacknight10 years agoOccasional Contributor
Vladimir found the answer. I had to disable "Support for testing Windows Store Applications."
it seems to be working now.
Thanks for the time and effort.
Dave
- Colin_McCrae10 years agoCommunity Hero
SetText is not good.
I only use it if I absolutely have to (which is almost never).
If you are testing a GUI (which it sounds like you are) you should always use 'Keys' over 'SetText'. SetText is a method for directly changing the content of a text field. Keys simulates the user pushing keys to type into the field. SetText does not.
If you use SetText you have a very good chance of missing any in-field or event driven validation in your application as it will not be seeing any keypresses.
It's good way to get yourself into impossible situations further down the line with no idea whats causing it ....