Total Pageviews

Wednesday, 17 March 2021

Creative Xpaths

 > Using greater than , less than etc in xpath


> using not contains in xpath

//prod[not(contains(type,'Business'))]

> Sometimes text are in two lines in DOM then inthat case use . (dot) instead of text() like

//div[contains(.,'qwerty')] 


Thursday, 30 July 2020

File Upload On JIRA Server Using PostMan / cURL

File Upload Using cURL

curl -H "Authorization:Basic U1TW9nW0OA1" -X POST -H "X-Atlassian-Token: nocheck" -F "file=@C:/Users/g7/Desktop/New/Test2.txt" https://capgmni-ogo.atlassian.net/rest/api/2/issue/QA-29/attachments



File Upload Using PostMan


Friday, 24 July 2020

Input Values Using JavaScript


if there is no value attribute in DOM for element the use
((JavascriptExecutor) getDriver()).executeScript("arguments[0].innerHTML='YOUR-VALUE-IN-SINGLEQUOT'",driver.findElement(By.xpath("//input[@id='xdc']")));


if there is value attribute defined in DOM then use
((JavascriptExecutor) getDriver()).executeScript("arguments[0].value='YOUR-VALUE-IN-SINGLEQUOT'",driver.findElement(By.xpath("//input[@id='xdc']")));

Sometimes in some applications .. like the application which are based on extJS framework the dom changes after performing some actions . For example




Here we see for the cell DOM looks as highlighted .

If  we double click on it to enable it then the DOM changes like ..


But using automation if we locate this element and try to send keys using selenium then it will throw selenium exception -- Element Not Intractable

That's one of the pain with extJS application while automating using selenium which occurs sometimes.

Now if you will right click on cell and select inspect




You will find a new element has been introduced in DOM to input values which earlier was not present.




So to insert value in scenarios like this you will fill first have to perform double click and then locate the element which appears later and send keys to it.





Tuesday, 30 June 2020

Sample Cucumber API TestCases

Steps To Test API

Step#1 Get Swagger document from Dev
Step#2 Write TCs based on document as TCs
Step#3 Get the TCs reviewed
Step#4 Execute the TCs in PostMan (Create Collection in PostMan for this execution if possible)
Step#5 Take screenshot of Postman execution response and response from DB in a document
Step#6 Attach screenshot document + Postman collection + swagger doc in story
Step#7 Mark story Done and assign to PO
Step#8 Automate apis

Saturday, 16 May 2020

Browser Automation Without Using Selenium Language Bindings

We will see :
1> Selenium Architecture
2> How language bindings issue command to browser driver and how browser driver performs those actions on actual browsers
3> Using selenium end points in postman
4> Creating postman collection to automate some steps

Download postman collection from 




Save Water | Save Energy | Save Earth     
    Stop Pollution | Stop Plastic
                 Spread Peace

Tuesday, 21 April 2020

How To Perform Bulk Operation In JIRA

In this video we will see how to perform bulk operation in JIRA  like bulk subtask creation in stories or like bulk status change of a ticket etc.





You can download macro from : swachalantech EXCEL MACRO


Save Water | Save Energy | Save Earth     
    Stop Pollution | Stop Plastic
                 Spread Peace

Wednesday, 25 March 2020

How to take full page screenshot in serenity bdd WITHOUT USING THIRD PARTY JARS OR LIBRARIES

Some times we need to take full page screenshot in case of failures. In this post we will see how to take full page screenshots without using third party jars like Ashot , Shutterbug etc.

Use the below code and call it whenever u need to take full page screenshot.



In serenity report we will see full page screenshots like below :







Code:

public void takeFullPageScreenShot() {
        try {
            int heightInner = Integer
                .parseInt(((JavascriptExecutor) getDriver()).executeScript("return window.innerHeight").toString());
            int heightTotal = Integer.parseInt(((JavascriptExecutor) getDriver())
                .executeScript("return document.documentElement.scrollHeight").toString());
            int scrollInitial = 0;
            int scrollFinal = heightInner - 150;
            ((JavascriptExecutor) getDriver())
                .executeScript("window.scrollBy(0,-" + Integer.toString(heightTotal) + ")");
            for (int i = 0; i < (heightTotal / scrollFinal); i++) {
                Serenity.takeScreenshot();
                ((JavascriptExecutor) getDriver()).executeScript(
                    "window.scrollBy(" + Integer.toString(scrollInitial) + "," + Integer.toString(scrollFinal) + ")");
            }
        } catch (Exception e) {
            logger.info(e.getMessage());
        }
    }