cancel
Showing results for 
Search instead for 
Did you mean: 

Event handler for textbox

SOLVED
Highlighted
Contributor

Event handler for textbox

Hi,

 

I have a situation where I have an amount text box and then Pay now button beneath it. When I enter the amount, the pay now button should be enabled and then the next step is to click on it. This is an automated script in Jscript. When I do manually, as soon as I enter the text, the pay button does get enabled. But when my automated script runs, it does settext in the textbox but then the button is still disabled. So the next event of clicking on it fails with the exception that the button is disabled. I tried to enable it but seems like I need to have an event handler for this. Do I write the event handler when the textbox has been filled in. Or may be in tab out from that textbox. Please help me to find the right approach.

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Event handler for textbox

@aa1 , I see you are working on this with the Support Team. Currently, they are waiting for more info from you.

Please provide them with the info so that they could move the investigation forward.

We will highly appreciate if you share the result of the investigation hereSmiley Happy Thank you.


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

8 REPLIES 8
Highlighted
Community Hero

Re: Event handler for textbox

Try using Keys instead of SetText.  That mimics a user typing in the box instead of just updating the field.  Perhaps that will trigger your button.

Contributor

Re: Event handler for textbox

Thank you for the reply. Yes I tried that but it made no difference at all. 

Highlighted
Community Hero

Re: Event handler for textbox

What else have you tried and what exactly happened when you did?   It's hard to help if we have to guess at the details.

Highlighted
Contributor

Re: Event handler for textbox

            Aliases.browser.page.form.textboxCreditCardNumber.Keys("");
            Aliases.browser.page.form.textboxCreditCardNumber.Keys("4110044510001234[Enter]");
            Aliases.browser.page.panel.panel.textboxCreditCardExpirationDate.Keys("");
            Aliases.browser.page.panel.panel.textboxCreditCardExpirationDate.Keys("12[Enter]");
            Aliases.browser.page.panel.panel.textboxExpirydateyear.Keys("");
            Aliases.browser.page.panel.panel.textboxExpirydateyear.Keys("2022");
            Aliases.browser.page.form.textboxCvvNumber.Keys("");            
            Aliases.browser.page.form.textboxCvvNumber.Keys("123");  
            Aliases.browser.page.form.textboxCvvNumber.Keys("[Enter]");           
            Aliases.browser.page.panel.panel.textboxExpirydateyear.Keys("[Tab]");
            Aliases.browser.page.panel.panel.textboxExpirydateyear.Keys("2022");
            Aliases.browser.page.panel.panel.textboxExpirydateyear.Keys("[Enter]");              
           
            aqUtils.Delay(ProjectSuite.Variables.ExistsTimeout);
            Runner.Pause();
            
            var btnPayNow = Aliases.browser.page.panel.panel2.buttonPayNow;            
           
            while (! btnPayNow.Exists)
            {
              aqUtils.Delay(ProjectSuite.Variables.ExistsTimeout);
              btnPayNow = page.NativeWebObject.Find("class", "Pay now", "btn btn-primary");
            }          
            
            
            btnPayNow.Click(); 

The above code is what I tried. I tried SetText as well. When it comes to the last line, it fails saying the button is disabled.

Highlighted
Community Hero

Re: Event handler for textbox

Try doing a small recording of the manual entry and see what TestComplete gives you back.  

Highlighted
Community Leader

Re: Event handler for textbox

In my opinion, the button activates a different action than typing text into it.

 

Remember that in JavaScript use browser API you can specify many of the locations you want to activate (become available) for other elements on the page.

 

The text input action can't necessarily be the correct one.

 

Ask the developer what is responsible for activating the button.


Is it not a case of a click on a text field or a .focus or .hover, a tab.

 

In development tools such as Google chrome, you can perform such actions yourself by selecting an item and right-clicking on it,

Highlighted
Community Manager

Re: Event handler for textbox

Community, thanks for your input.

@aa1 were you able to resolve this? 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Community Manager

Re: Event handler for textbox

@aa1 , I see you are working on this with the Support Team. Currently, they are waiting for more info from you.

Please provide them with the info so that they could move the investigation forward.

We will highly appreciate if you share the result of the investigation hereSmiley Happy Thank you.


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors