Ask a Question

Cursor is not switched to the other input fields in hybrid mobile application.

smartbearrj
Contributor

Cursor is not switched to the other input fields in hybrid mobile application.

Hi ,

 I am automating the functionalities in hybrid mobile application and problem i am facing is below -

 

 My application has a web page which has 3 fields- username ,password and login button. Now I am able to find all the objects in the page but when i am trying to send the string in the password box after successfully sending in username box, password is not being entered in the password box instead it is inserted in the username itself.

 

Please suggest what might be the reason.

 

I had the same issue in desktop mode at long time back but i can not recall what i had done to solve the issue. 

 

Thanks.

 

15 REPLIES 15
AlexKaras
Champion Level 3

Hi,

 

a) How input is sent to control in your test code?

b) Does it help if you set an input focus (.Click() ) or .SetFocus() ) to the required control before entering the text ?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

Hi @AlexKaras,

1--  I am trying both - Keys(object ,string) and setText(object, string). 

2-- I have not tried it yet. I am going to try setFocus and click()

 

 

Thanks,

 

> I am going to try setFocus and click()

Yes, please. While <object>.Keys() is expected to put required keys sequence into <object>'s input queue, I've seen the cases when the input was sent to (or intercepted by?) some other control. Explicit input focus setting to the required control always solved this problem.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

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();

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

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. 

 

> 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?

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

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.

I have tried both. Also I put wait after the operation but problem not resolved. 

cancel
Showing results for 
Search instead for 
Did you mean: