Page 1 of 1

Determine if login dialog in web browser is present or not

Posted: 18 Oct 2017 08:33
by Freakadude
Hi Martin,

I am curretly doing some automation where i use a web browser access to do some stuff. Now the main activities i can setup fine however i want to build in a condition check weather or not the login dialog pops up in the web browser or not.

Reason is that over a couple of sessions the browser retains the username and login but if i completly kill the browser for whatever reason then next time the flow opens the browser it is prompted with the login dialog pop up.

What i want to do is setup a script condition check which checks once the page has been loaded if the login dialogue has popped up or not. If yes then the flow continues to input the user and pass first if no it continues to do its thing as normal.

I can check with the UI overlay the exact box name that pops up and i would imagine to write the script to check if it detects this box name or not but i just don't find the right way which function i should use in my script to best check for this.

Any help would be appriciated.

Thanks!

Re: Determine if login dialog in web browser is present or n

Posted: 18 Oct 2017 10:22
by Freakadude
In the meantime i have solved this in my flow now in a different way (before executing the browser step i close the browser session therefore making sure the login dialogue allways comes up) but for future reference i would still like to know (if someone can help) what type of function command i could do a check weather or not a login field/box etc is being shown in a browser screen to be able to act on it appropriately.

Re: Determine if login dialog in web browser is present or n

Posted: 18 Oct 2017 16:59
by Desmanto
How do you fill the data in the login dialog pop up? Can you use Control UI to fill the username password?
AFAIK, most browser sandbox their content, so the frame inside browser is not exposed to accessibility.

But if you can use Control UI to detect the pop up dialog, then you can use while() to loop detect the real page without login popup. There supposed to be certain element id exist when the real page is shown. Within 500 ms, if not detected, it will try to detect the login popup element id. If detected, continue the script to fill the usename password.

If you want to do automation to a certain fix action, you can try to use HTTP request. It is much faster, no UI distraction and more reliable
This maybe can be a reference : viewtopic.php?f=5&t=6998

Re: Determine if login dialog in web browser is present or n

Posted: 20 Oct 2017 10:44
by Freakadude
My workaround was the following: Since the login pop up only comes in the browser if the browser had been closed in the background programs and is started fresh. So what i did in my flow is that i first start with closing the browser from the background programs then do the URL call which will now allways result in the login pop up. Then using the contrul UI function i fill in the user and password and login.

The only issue with this is now that this only works if the screen is on and unlocked which is still a problem for me so i still need to think about a solution to this particular issue.

Re: Determine if login dialog in web browser is present or n

Posted: 20 Oct 2017 14:41
by Desmanto
Strange. At mine, chrome doesn't give me the pop up. Control UI won't work. Maybe it depends on the site too.

For your case, the only way to make it work with screen off is using HTTP request. If you see the link above, that is the flow I am using. And it has been working fine since the first time I made till now. My phone don't need to be screen on and unlocked. It will automatically vibrate when it finish restarting the mifi (or give error notification sound if failed).

Re: Determine if login dialog in web browser is present or n

Posted: 20 Oct 2017 17:15
by Freakadude
Thx for the tip Desmanto. I have now switchted to using HTTP call function and it works perfectly.

BTW regarding your tutorial with Wireshark etc. You can also findout such info in Chrome by simply opening the developer tab (F12) on a new page and while loading and interacting with the page you can find all these infos there as well. Thats how i did it in the end :)

Re: Determine if login dialog in web browser is present or n

Posted: 21 Oct 2017 03:55
by Desmanto
That means I am doing it the hard way all this time :shock:
Chrome dev tab is much more specific, I don't need to filter out other data anymore.
Thanks for the tip.