Set text operates as click and set text

hi,
I want to set text in one text field. but when i perform set text operation on text field it performs click on that text field and then it sends text to text field. My problem is when it performs click operation on text field it opens calendar (designed function of of app) and because of that i am not able to send text to text field. kindly help.

set text.png

Did you try using WebUI.sendKeys()?

2 Likes

Mate Mrse said:

Did you try using WebUI.sendKeys()?

Seconded.

However, I would also inform the HTML developers that their UX is not very friendly. If a user were to do the same thing (which is certainly reasonable) then they wouldn’t be able to type, either.

1 Like

Mate Mrse said:

Did you try using WebUI.sendKeys()?

I am doing mobile testing so i have used Mobile.settext (),

My problem is when it performs click operation on text field it opens calendar (designed function of of app) and because of that i am not able to send text to text field.

You don’t have to perform click operation on the text field.

You just do WebUI.setText(target, text), then the text will be set into the field.

kazurayam said:

My problem is when it performs click operation on text field it opens calendar (designed function of of app) and because of that i am not able to send text to text field.

You don’t have to perform click operation on the text field.

You just do WebUI.setText(target, text), then the text will be set into the field.

i am not performing click operation on text field, but when i used set text commend, KATALON by default perform click and set text operation combinly on that text field. as it perform click operation first because of that i am not able to use set text operation.

thanks and regards, sanket gharat.

because of that i am not able to send text to text field.

Curious. I know another web app which has a text filed with calendar; looks similar to yours. And that web app works differently. There I could send text into the field with WebUI.setText() operation.

The web app I mean is the Sample Web UI Testing Project. You can easily reproduce the project in Katalon Studio by operation: File > New Sample Project > Sample WebUI Testing Project .

Or simply open a demo site http://demoaut.katalon.com/ , click “Make Appointment” button, type
Username: John Doe
Password: ThisIsNotAPassword
and click Login button. Then you will see a Web page with a field with calendar popup.

In this sample project, I could set text by WebUI.setText() operation.

It may depend on the web app design if a date field is manually editable or not. The Sample Web UI Testing Project is allowing it. Your target Web app is not allowing it.

I suppose your target web app might be designed so that the text field is NOT manually editable at all; therefore your script has to work with the calendar popup in order to set text into the field — a messy job. But I am not too sure.

page_with_a_text_field_supported_by_calendar_ui.png

1 Like

dear kazurayam,

i tried the demo site given by you, thanks for that. it works perfectly,
But i am doing mobile testing and i have connected my mobile to laptop by USB, Mobile screen appears on laptop screen, and i am performing operations on that appeared screen by using record mobile option. when i use set text commend which is on record mobile window, it operates click and set text operation.

in second case (attached snap) also i am facing same problem ,
when i use set text commend for CardNumber it gives pop up like “complete action using” .after selecting keyentry/ scan when i again use settext i am getting same pop up.
manually it works perfectly…

Screenshot_20180523-121848(1).jpg

Sorry, I have very little experience for mobile testing.

Mate Mrse said:

Did you try using WebUI.sendKeys()?

hey it works…
thanks a lot…

sanket gharat said:

Mate Mrse said:

Did you try using WebUI.sendKeys()?

hey it works…
thanks a lot…

I’m having the same issue, kindly specify the complete statement along with arguments.

Hamid Ayub said:

sanket gharat said:

Mate Mrse said:

Did you try using WebUI.sendKeys()?

hey it works…
thanks a lot…

I’m having the same issue, kindly specify the complete statement along with arguments.

hi,

simply use
WebUI.sendKeys()
command instead of WebUI.settext().

settext() will click and it will send string in text box where as sendkeys() will only send string ti text box.

1 Like

sanket gharat said:

Hamid Ayub said:

sanket gharat said:

Mate Mrse said:

Did you try using WebUI.sendKeys()?

hey it works…
thanks a lot…

I’m having the same issue, kindly specify the complete statement along with arguments.

hi,

simply use
WebUI.sendKeys()
command instead of WebUI.settext().

settext() will click and it will send string in text box where as sendkeys() will only send string ti text box.

Hi Sanket gharat,

can u explain to me how to use sendkeys in mobile app? i was try, but still failed.
should i use webUI for mobile testing?

Thanks before

Hi Husnah,

Using Katalon’s sendKeys function:

Add this import to your test file:

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile 

Then send the keys to the textField Test Object:

Mobile.sendKeys(textField, "My Value"); 

Using Appium’s sendKeys function:

If that doesn’t work, you can try using Appium’s sendKeys function directly:

Add these import statements to the top of your test file:

import io.appium.java_client.android.AndroidDriver
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory

Then tap the textField Test Object to open the keyboard and send the keys using Android’s keyboard:

int timeout = 5 // timeout in secondsMobile.tap(textField, timeout)
AndroidDriver<?> driver = (AndroidDriver<?>) MobileDriverFactory.getDriver()
driver.getKeyboard().sendKeys("My Value")

Using a wrapper function from katalon-mobile-util library:

Finally, if that’s a lot to type each time you want to set the text on a field, you can try using this open source library, which has some convenience functions for handling Text Fields:

https://github.com/detroit-labs/katalon-mobile-util#textfield

You can access a built version of the library here:

https://github.com/detroit-labs/katalon-mobile-util#installation

For info on how to add a third party library to you Katalon test project, see the docs:

https://www.katalon.com/resources-center/tutorials/import-java-library/

Hope this helps,

Chris

1 Like

Chris Trevarthen said:

Hi Husnah,

Using Katalon’s sendKeys function:

Add this import to your test file:

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile 

Then send the keys to the textField Test Object:

Mobile.sendKeys(textField, "My Value"); 

Using Appium’s sendKeys function:

If that doesn’t work, you can try using Appium’s sendKeys function directly:

Add these import statements to the top of your test file:

import io.appium.java_client.android.AndroidDriver

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory


Then tap the textField Test Object to open the keyboard and send the keys using Android's keyboard:

int timeout = 5 // timeout in secondsMobile.tap(textField, timeout)
AndroidDriver<?> driver = (AndroidDriver<?>) MobileDriverFactory.getDriver()
driver.getKeyboard().sendKeys(“My Value”)


  

Using a wrapper function from katalon-mobile-util library:
----------------------------------------------------------

Finally, if that's a lot to type each time you want to set the text on a field, you can try using this open source library, which has some convenience functions for handling Text Fields:

[https://github.com/detroit-labs/katalon-mobile-util#textfield](https://github.com/detroit-labs/katalon-mobile-util#textfield)  

You can access a built version of the library here:

[https://github.com/detroit-labs/katalon-mobile-util#installation](https://github.com/detroit-labs/katalon-mobile-util#installation)  

For info on how to add a third party library to you Katalon test project, see the docs:

[https://www.katalon.com/resources-center/tutorials/import-java-library/](https://www.katalon.com/resources-center/tutorials/import-java-library/ "Link: https://www.katalon.com/resources-center/tutorials/import-java-library/")  

Hope this helps,

Chris

  

Hi Chris,
thanks a lot for ur answer. it works :slight_smile:

Chris Trevarthen said:

Hi Husnah,

Using Katalon’s sendKeys function:

Add this import to your test file:

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile 

Then send the keys to the textField Test Object:

Mobile.sendKeys(textField, "My Value"); 

Using Appium’s sendKeys function:

If that doesn’t work, you can try using Appium’s sendKeys function directly:

Add these import statements to the top of your test file:

import io.appium.java_client.android.AndroidDriver

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory


Then tap the textField Test Object to open the keyboard and send the keys using Android's keyboard:

int timeout = 5 // timeout in secondsMobile.tap(textField, timeout)
AndroidDriver<?> driver = (AndroidDriver<?>) MobileDriverFactory.getDriver()
driver.getKeyboard().sendKeys(“My Value”)


  

Using a wrapper function from katalon-mobile-util library:
----------------------------------------------------------

Finally, if that's a lot to type each time you want to set the text on a field, you can try using this open source library, which has some convenience functions for handling Text Fields:

[https://github.com/detroit-labs/katalon-mobile-util#](https://github.com/detroit-labs/katalon-mobile-util#textfield "Link: https://github.com/detroit-labs/katalon-mobile-util#textfield")[i](https://atozsofts.com/software/inpage_free_download/ "Link: https://atozsofts.com/software/inpage_free_download/")[npage](https://atozsofts.com/software/inpage_free_download/ "Link: https://atozsofts.com/software/inpage_free_download/")  

You can access a built version of the library here:

[https://github.com/detroit-labs/katalon-mobile-util#installation](https://github.com/detroit-labs/katalon-mobile-util#installation "Link: https://github.com/detroit-labs/katalon-mobile-util#installation")  

For info on how to add a third party library to you Katalon test project, see the docs:

[https://www.katalon.com/resources-center/tutorials/import-java-library/](https://www.katalon.com/resources-center/tutorials/import-java-library/ "Link: https://www.katalon.com/resources-center/tutorials/import-java-library/")  

Hope this helps,

Chris

  

Really Helpful for me.thank you.