If Else in weblog in page


I am trying to login to my company portal with my AD details, first time login on the portal comes with login page (user name and password) details, and once it is logged in successfully, subsequent logins directly lands on home page (skip log in page). I need to create a process where it can check if it is login screen, then enter login details else move to home page.
I hope problem statement clear. Any help / ideas will be appreciated.

Regards - Ram

The most effective solution is to break your process into individual pieces and workflows. Have one sequence to log you into the app. Have another one to log you out. Maybe create one to check whether you are logged in or not. Then, combine them together in another workflow where you’d check whether you need to login or not. This may be achieved with the ReFramework, but depending on your requirements that might be overkill.

However, you may also work with the Find Element activity - imagine that you want to access a protected resource, such as http://myapp.local/users/1 - if you’re not yet logged in, the page might show you a login screen. Checking whether an element exists - such as the user name or password field - would provide you with the information if a login is required or not.

Thank you for your response, breaking the process seems to be a good solution.

Is there any way we can check the window title because login window and home page window has different title?
Please see below screenshot-

By this way we can identify the webpage title and using if-else write further logic. Please let me know if this possible.


in your case, you get the title attribute. please refer the post

you can use the get attribute activity.

I got this working using page title. But there is blocker, I need to enter some data into HTML rich text editor, and web recorder doesn’t recognize this, throws exception every time this control is reached.
Any suggestions?

What kind of exception? Can you select the element using UiExplorer? Could you alternatively use tab to have the cursor set to the textbox, and then just type the value?

Depending on how you construct the workflow, you have the following options:

i) Use element exist (returns boolean), and later with an if statement do your validations

ii) If you are sure that after a specific activity, an element must be there, use the find element where it waits until the element appear (default timeout = 30s)

I tried number of ways to type value in rich text control but unfortunately no luck, however I got this working by creating a javascript and inserting text using Inject JS script activity. (Workarounds are always there :slight_smile: )