Event handler for textbox
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the reply. Yes I tried that but it made no difference at all.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try doing a small recording of the manual entry and see what TestComplete gives you back.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Community, thanks for your input.
@aa1 were you able to resolve this?
Sonya Mihaljova
Community and Education Specialist
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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 here Thank you.
Sonya Mihaljova
Community and Education Specialist
