Forum Discussion

kerriem's avatar
kerriem
Occasional Contributor
3 years ago
Solved

how to prevent launching browser with focus in address bar

New to TestComplete and trying to automate my first test of launching our WebUI application in any browser (tried in Chrome and Firefox). 

I am writing the script in Python and have the following: 

 

#Launch WUI Login Page
Browsers.Item[btFirefox].Run(Project.Variables.WUI_LoginURL)

browser=Aliases.browser
#Maximise browser window
browser.BrowserWindow.Maximize()

 

At this point, our login page launches correctly and the cursor should be in the Username field, however it is sitting in the address bar of the browser window instead.

If I launch the WebUI application myself though the cursor appears in the Username field fine.

 

Having read a bit in the forums I found an article which suggested using Click() to click into the login page, however the default location for the click is centrally on the page it appears, which clicks me into the password field instead.

I would prefer to avoid the Click entirely and actually be able to verify that focus/cursor is automatically in the Username field but I cannot find a way to do this.

 

I am able to proceed using SetText and type in the Username field without a problem, however I would really like to be able to prove that focus is in the Username field on launch.

 

Any help appreciated!

  • Hello kerriem 

     

    Have you tried a Keys operation into the URL field? Maybe it requires being typed instead of a SetText operation.

7 Replies