Postman is developed on Node.js that gives dynamic characteristics to Collections and requests. We can create test suites, execute requests having changing parameters, send data in between requests, and so on.A JavaScript can be associated with a request twice. Once before the actual request has been sent(as a pre-condition script added under the Pre-Request Scripts tab)and after the Response from the request has been received (as a test script added under the Tests tab).Let us send a GET request along with Pre-Request and Test scripts.Pre-Request Script −console.log("Tutorialspoint - Postman")Testsconsole.warn("Warning message in console") console.log("Logging message in console") console.info("Info message in console") ... Read More
Answer − Postman Sandbox is an Environment provided to execute JavaScript written as a part of the Pre-Request and Tests scripts for a request. This can be available for both Postman and Newman. Thus every script developed under the Tests or Pre-Request Scripts tab can be executed within this Sandbox.Libraries and Utilities used in Postman Sandbox −Lodash - a utility in the JavaScript library.cheerio.BackboneJS.SugarJS.CryptoJS.Environment, Global, Dynamic variables & CookiesTo set an Environment variable, we have to add the below script −postman.setEnvironmentVariable(name of variable, value of variable)To set a Global variable, we have to add the below script −postman.setGlobalVariable(name of variable, ... Read More
We can share session id across different requests in Postman. We can send a cookie value obtained from a request to a different request. This can be done only if the website is similar.A particular server can identify its own cookie. This makes a cookie highly secured. The cookies are passed to another request to store the information of the user preferences as it navigates through the webpages.A session id is similar to an expiration of a token. As the session id gets expired, an user has to again authenticate his credentials. As a user logs in for the first ... Read More
We can get the error - Element is not clickable at point while trying to click a link in Selenium webdriver. This is common in chromedriver as the Chrome browser determines an element with point location.When the position of an element is changing and we make an attempt to click on it, this error is encountered. This is because the element is present in DOM, but its position is not fixed on the page.There are some workarounds to fix this error as listed below −Adding the explicit wait. The webdriver can wait till the expected condition - visibilityOf(webdriver shall wait ... Read More
We can set Tests using the Functional method in Postman. A test in Postman gets executed only if a Request is successful. In case a Response does not get generated, the test does not to validate it.Tests implemented in the Functional method are written within the Tests tab.Add the following verification using the Functional method within the Tests tab −pm.test["Status Code is 401"], function(){ pm.response.to.have.status(401) })Here, pm.test is the function. Status Code is 401 is the test name which shall be displayed in the Test Result tab after execution. The pm.response is used for getting the Response ... Read More
We can keep a session alive for long Selenium scripts in automation. In Chrome browser, this can be achieved with the help of the ChromeOptions and Capabilities classes.Capabilities class can get the capabilities of the browser by using the method – getCapabilities. This technique is generally used for debugging a particular step in a scenario having a sizable amount of steps.First, let us try to input text in the highlighted edit box in the below page −Code Implementationimport org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.Capabilities; import org.openqa.selenium.By; import java.util.Map; import java.util.concurrent.TimeUnit; public class BrwSessionAlive{ public static void main(String[] args) ... Read More
We can set multiple Tests for a Request in Postman with JavaScript method. A Test in Postman gets executed only if a Request is successful. In case a Response does not get generated, a test does not to validate it.Tests implemented in the JavaScript method are written within the Tests tab.Add the following JavaScript verifications within the Tests tab −tests["Status Code should be 200"] = responseCode.code === 200 tests["Response time lesser than 10ms"] = responseTime
We can handle SSL certificates in Edge browser with Selenium webdriver. This is done with the help of the EdgeOptions class. We shall create an object of this class and set the parameter setAcceptInsecureCerts to the true value.Finally, this information has to be passed to the webdriver object to get the desired browser settings. An SSL is a protocol designed to establish a secured connection between the server and the browser.SyntaxEdgeOptions e = new EdgeOptions(); e.setAcceptInsecureCerts(true);Code Implementationimport org.openqa.selenium.WebDriver; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.edge.EdgeOptions; public class EdgeBrwserSSL{ public static void main(String[] args) { System.setProperty("webdriver.edge.driver", "C:\Users\ghs6kor\Desktop\Java\msedgedriver.exe"); ... Read More
We can automate Instagram login page with Selenium webdriver in Java. To achieve this, first we have to launch the Instagram login page and identify the elements like email, password and login with the findElement method and interact with them.Let us have the look at the Instagram login page −Code Implementationimport org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; public class InstagramLogin{ public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:\Users\ghs6kor\Desktop\Java\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); //implicit wait driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //URL ... Read More
Selenium webdriver is used widely for web automation. This because of the reasons listed below −Selenium webdriver comes without any cost and we do not need to buy a license for its usage. We can just download and start using it for automating the test cases.Selenium webdriver can be used to stimulate human-like actions like drag and drop, keypress, click and hold, and so on. This is done with the help of the Actions class.Selenium webdriver has a very friendly API which makes it easier for the users.Selenium webdriver can support multiple languages like Java, Python, JavaScript, C# and so ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP