Thursday 26 October 2023

Using one XPath for multiple login page

I had a scenario in multi tenant azure environment, where the login page were different for DEV, UAT, STG environment. Instead of creating separate login page for each environment, I had to optimise by having one login handler.

People can have different approach to handle Login Page.

I implemented a solution where irrespective of login page, we should have a single XPath for Username, Password and Signin button.

The solution is very simple to implement of having multiple "or" conditions in the XPath of username field, password field and signing button.

Ultimately, the appearance of the Username field is important. 

Let's take an example of different login page of outlook.com and yahoo.com username field, I used below XPath

//input[@id='login-username' or @id='i0116']

Please refer below screenshot.







-Pankaj Dhapola
Let's Think on it

Thursday 24 August 2023

[VS-Code] Activate python environment before starting debugging a file

While debugging a particular file on python, I came a scenario where I required to activate the python environment right after we start debugging.
By default, VS code starts PowerShell terminal.

Below is the modification required in launch.json file


       
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "env": {"PATH":"${workspaceFolder}/venv/Scripts/"},
            "console": "integratedTerminal",
            "justMyCode": true,
            "autoReload": {
                "enable": true
            }
        }




-Pankaj Dhapola
Let's Think on it