Forum Discussion
Hi AlexKaras,
Could you plz suggest how to use setFocus() method . I am finding in my log obj.SetFocus() is not a function.
Thanks,
> I am finding in my log obj.SetFocus() is not a function.
.SetFocus() exists not for all controls.
Check in the Object Browser if it exists for the given control.
P.S.
Some more universal code might be like this:
if (aqObject.IsSupported(<object>, 'SetFocus'))
<object>.SetFocus();
else
<object>.Click();
- smartbearrj7 years agoContributor
No Its is not havng SetFocus( ) method.
Also one more thing whcih i am seeing in my object browser -
However I can find the controls in the object browser with all its properties and methods , I can not see the control in the object preview .And I think this is the reason why keys are not sent ot the control!
I have attached the Screen shot below.
- AlexKaras7 years ago
Champion Level 2
> I think this is the reason why keys are not sent ot the control!
While it is strange that nothing is shown in the object preview and you may ask Support difectly about this via the https://support.smartbear.com/message/?prod=TestComplete form, I do not think that this is the reason for the input problem.
Have you tried to .Click() this textbox? Does this resolved the problem with the input text? Can you see Click and/or SetFocus methods on the Methods pane of the Object Browser?- Marsha_R7 years ago
Champion Level 3
You can try recording a keyword test that does what you want and see what TC creates from that. You can then convert that to a script to get even closer to what you need.