cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with TestComplete locating a pop up

SOLVED
Highlighted
New Contributor

Problem with TestComplete locating a pop up

Hi Everyone,

I have been trying to find a solution or even a workaround for an issue with my TestComplete Keyword mode script, which seems unable to find a pop up window.   I actually see the application is launching a pop up with the name "Scheduler" but I believe since I did not create the popup I cannot reference it by that name.


In any event I tried looking at this link but there is still a missing piece for me.

https://support.smartbear.com/testcomplete/docs/testing-with/running/handling-errors/object-not-foun...

 

I am able to select the window with the object spy.  However, here is what I am doing incorrectly - I try to use setFocus() as a code snippet to change the focus to the popup window... In Object Spy the Window is named "BrowserWindow(1)" but "BrowserWindow(1).setFocus() does not work (not surprisingly).

 

In Selenium there is a way to "getWindowHandles()" to get all open windows and then you switchTo() and reference the window you want.


Here I am at a loss as to how to resolve this... I was trying to even look up how to workaround this by just using JavaScript but again I am trying to locate a window that is open that was launched as a result of a click action in the application I am testing. (in JS it is fairly straightforward if you want to reference a popup you yourself created, but that is not the case here) 

 

My object map has the element but basically I want to switch the focus to the popup - enter some data in input fields on the popup, and then close the popup via click of another button (if I can switch the focus the rest should be easy).

 

Thanks in advance for any suggestions you may have... I attached some screenshots.

 

(~ (TestComplete Version: 12.42.3048.7 x64 | Firefox 52.4.1 (64-bit) ~)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Problem with TestComplete locating a pop up

 

Try to call snippet: Alias.browser.BrowserWindow(1).SetFocus();

 

Does it help?

 

 

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: Problem with TestComplete locating a pop up

Hi!

 

Try to interact with Page object instead of BrowserWindow:

 

Capture.PNG

Highlighted
New Contributor

Re: Problem with TestComplete locating a pop up

Thanks, baxatob!  I am finding I am going down quite the rabbit hole with this.
Can you give me an example syntax for doing this?  TestComplete seems to want me to "define" the Page object.

When you say, "Try to interact with Page object instead of BrowserWindow"

I understand I can look at the page object and work with its methods... but I find that it tells me that the page object is undefined, and I am clearly not either referencing it properly or defining it to TestComplete's satisfaction.

 

Conceptually I am trying to locate the window and change the focus to the window so I can then perform some actions on that window.  I could also try to locate all the children of "Sys" that are browser windows, and pick the one with the URL in question, but it seems like that is not how TestComplete "works".

 

Part of the problem may be that I am in keyword mode where I feel like my low-level control of what is happening may be limited, but I have only used the script mode for piecemeal things.

 

Thanks!

Erik

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/web/general/page/met...

https://developer.mozilla.org/en-US/docs/Web/API/Window

Highlighted
New Contributor

Re: Problem with TestComplete locating a pop up

I seem to be making progress with this:

 Sys.Browser("firefox").BrowserWindow(1).SetFocus()
Highlighted
Community Hero

Re: Problem with TestComplete locating a pop up

 

Try to call snippet: Alias.browser.BrowserWindow(1).SetFocus();

 

Does it help?

 

 

View solution in original post

Highlighted
Community Hero

Re: Problem with TestComplete locating a pop up

Sure, you can't ignore parents 🙂

 

 

P.S. Also I would recommend to learn more about NameMapping: https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/over...

 

 

Highlighted
New Contributor

Re: Problem with TestComplete locating a pop up

Yes, the below worked.

Sys.Browser("firefox").BrowserWindow(1).SetFocus();

 

Yes, thank you! I know I need to better harness the power of name mapping, I will follow your advice.  I have much to learn in the TC realm.. will also need to brush up on my JavaScript.

 

In another life I was a front-end developer, but I have been in QA for years, and mostly worked with Selenium and Java... it's very different the way TC handles its repository..

 

Thank you!  And Happy New Year!

Erik

 

 

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors