Forum Discussion
Object Spy will display to you within TestComplete how TestComplete identifies the object. Again, as noted in my post, this was a guess as to what's going on due to your lack of detail. However, since object identification doesn't seem to be the problem, this is moot.
However... here's my thinking... the combobox field you're sending the keys command to might have an "on-exit" event that, if the keystrokes aren't entered properly, might fail to actually complete the process. Sometimes this is handled simply by adding the "Enter" keystroke.
Try changing your code to :
var myObject = page.NativeWebObject.Find("id", "step2_purposeOfTxn", "select") if (myObject.Exists){ myObject.Keys(Project.Variables.MAT_Inputs("Reason")+'[Enter]') }
Two things... first, before attempting to work with the object, I check to make sure that I actually found something. This is ALWAYS a best practice when using a Find method. Secondly, this will add the enter keystroke at the end of the data entry to trigger any "on-exit" or other events that might be necessary to complete the data entry field. Give this a try and see if it works.
page.NativeWebObject.Find("id", "step2_purposeOfTxn", "select").Keys(Project.Variables.MAT_Inputs("Reason"))
I used page.Keys("[Enter]") after this but it is working only for one iteration , in 2nd iteration again it's failed to select an item from dropdown.
- AlexKaras7 years agoChampion Level 3
Hi,
> page.NativeWebObject.Find
I would highly recommend not to use NativeWebObject but move to TestComplete's provided .FindChild() method:
page.FindChild(...)
> but it is working only for one iteration
I hope that https://community.smartbear.com/t5/TestComplete-General-Discussions/You-are-trying-to-call-the-quot-Click-quot-method-or-property-of/m-p/154273#M28439 explains the possible reason for this.
- tristaanogre7 years agoEsteemed Contributor
Are you certain the value of "Reason" is actually in the drop down? I've had situations in my own AUT where there is an extra space at the end of the item that wasn't immediately visible on screen.
Related Content
- 10 months agolodecesa
- 11 months agomgormsen
- 2 years agoKB1
- 5 years agopaarmann-ara
Recent Discussions
- 4 hours agoJacobjacob44