Forum Discussion
I just recorded the following using TC12, the latest version of Chrome, and the TestComplete forum page.
function Test1() { var browser; var page; Browsers.Item(btChrome).Navigate("https://community.smartbear.com/t5/TestComplete/ct-p/TestComplete_forum"); browser = Aliases.browser; page = browser.pageCommunitySmartbearComT5Testc; page.panel.footer.link.Click(); browser.pageSmartbearComProductTestexecu.Wait(); }
With this recording, when I playback, everything works fine... I don't even need to do a "ScrollIntoView"...TC automatically handles that.
So... what's different between what you're doing and what I'm doing?
I even made the following change,
function Test1() { var browser; var page; var link; Browsers.Item(btChrome).Navigate("https://community.smartbear.com/t5/TestComplete/ct-p/TestComplete_forum"); browser = Aliases.browser; page = browser.pageCommunitySmartbearComT5Testc; link = page.FindChild(['ObjectType', 'href'], ['Link', 'https://smartbear.com/product/testexecute/overview/'], 2000); link.Click(); browser.pageSmartbearComProductTestexecu.Wait(); }
Where, instead of just clicking, I find the object I want and then click it.
So... something still is different.
What type of object is it? What type of control? I see it saying "Button" as an object type but what sort of behind the scenes language and structure is being implemented to build those buttons? It could be that something is implemented differently in your application under test than what I'm experiencing.
- tristaanogre8 years agoEsteemed Contributor
Here's an interesting thought... I took a quick browser through the "related topics" on the right side of the screen here for your post (lots of folks have run into similar situations). In some of the cases, the scroll didn't happen if the object itself was not actually visible yet... or the object was not enabled... or things like that.
So, you're telling TestComplete to go click on your button. Obviously, you've found the button... but is it enabled? Is it actually ready to be clicked at the moment that TC attempts to click it? Could it be that it's waiting for some other process or script on the page to complete before you can click on the button?
Just some things that my cold-medicine addled brain is processing today...- tristaanogre8 years agoEsteemed Contributor
One other follow up:
One of those other threads presented an interesting problem with a dialog... that each time the dialog was created on the page, it was kept on the page but disabled... so, every time through the test, there would be a new, disabled copy of the dialog on the page. TestComplete couldn't interact with it because it wasn't on screen or visible... and yet, the human eye inspection said, "But I am looking right at it..."
So... investigate, also, how the buttons are instantiated... it COULD be that you may be finding the button but finding the wrong COPY of the button and, therefore, cannot always click on it. - hhagay8 years agoContributor
Robert good morning
Thank you for the rapid reply
I hope I am not adding to you headache :) -- Feel better
To you questions:
Page form is dynamically created using react, so objects carry "unique' IDs (which is also an issue I found with TestComplete, but let's leave it to another post).
As you see in the snapshot above, the object is readily available, loaded, activated, etc.
Please note: The Rate Per Hour input field and Rate Per Week input field work simply because they are "visible" to TC during PLAYBACK. The Guaranteed Hours input field is not (you have to scroll to see it), and that's where TC fails.
Robert: I executed the script and when it reached this page, I manually scrolled the page and TC was able to interact with the object.
Let me know if you need more information.
- tristaanogre8 years agoEsteemed Contributor
OK... so, the objects in this case are being dynamically created... so, there is a possibility that, in the fraction of a second after completing one action and when you attempt to click on the button, box, link, etc., that the object is in the process of being created but, perhaps, is not fully enabled and ready to be interacted with. That's the point I was trying to make in my one post... that you may have found the object (ObjectType == 'Button', contentText = 'Submit Employee') but it might not be in a state that can be interacted with yet.
Try something... without using the "ScrollIntoView"... what happens if you throw in just for debugging purposes a call to aqUtils.Delay and have it just "sleep" for a couple of seconds... Kind likeif (btn.Exists) { Log.Message(btn.FullName); //btn.scrollIntoView(); aqUtils.Delay(2000); btn.Click(); } else Log.Error("The object was not found.");
See if this is a timing issue of sorts that the scrollIntoView might be masking by adding JUST long enough of a delay before the click is attempted.
EDIT: And thanks for the well-wishes... it's not as much a headache as it is sneezing, coughing, and general malaise... Ah, well.. at least I can still write script code. ;)
Related Content
- 10 years agoamithsid