
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 33676 Articles for Programming

2K+ Views
We may encounter StaleElementReferenceException while working with Selenium webdriver. We can fix the StaleElementReferenceException in the Selenium webdriver. The term stale means something which is not fresh and decayed. Thus a stale element points to an element that is not present anymore.There may be a case when an element was in DOM initially but after modifications in Document Object Model (DOM), the element becomes stale and the StaleElementReferenceException is thrown if we attempt to access this element.This exception is caused whenever an element is not present in the DOM or deleted. We can handle this exception in the following ways ... Read More

1K+ Views
We can manually set proxy settings using Selenium webdriver in Python. It is done using the DesiredCapabilities class. We would create an object of this class and apply the add_to_capabilities method to it. Then pass the proxy capabilities as a parameter to this method.ExampleCode Implementationfrom selenium import webdriver from selenium.webdriver.common.proxy import ProxoxyType #add proxy’s ip and port p = '' pxy = Proxy() #set proxy type pxy.p_type = ProxyType.MANUAL #http proxy pxy.http_pxy = p #ssl proxy pxy.ssl_pxy = p #object of DesiredCapabilities c = webdriver.DesiredCapabilities.CHROME #set proxy browser capabilties pxy.add_to_capabilities(c) #set chromedriver.exe path ... Read More

15K+ Views
We can use a specific Chrome profile in Selenium. This can be done with the help of the ChromeOptions class. We need to create an object of this class and then apply addArguments method on it.The path of the specific Chrome profile that we want to use is passed as a parameter to this method. We can open Chrome’s default profile with Selenium. To get the Chrome profile path, we need to input chrome://version/ in the Chrome browser and then press enter.Syntaxo = webdriver.ChromeOptions() o.add_argument = {'user-data-dir':'/Users/Application/Chrome/Default'}ExampleCode Implementationfrom selenium import webdriver #object of ChromeOptions class o = webdriver.ChromeOptions() #adding specific ... Read More

3K+ Views
We can automatically download a pdf with the Selenium webdriver in Python. A file is downloaded in the default path set in the Chrome browser. However, we can modify the path of the downloaded file programmatically in Selenium.This is done with the help of the Options class. We have to create an object of this class and apply the add_experimental_option. We have to pass the parameters - prefs and the path where the pdf is to be downloaded to this method. Finally, this information has to be sent to the webdriver object.Syntaxop = Options() p = {"download.default_directory": "../pdf"} op.add_experimental_option("prefs", p)ExampleCode ... Read More

14K+ Views
We can parse JSON Response with Rest Assured. To parse a JSON body, we shall use the JSONPath class and utilize the methods of this class to obtain the value of a specific attribute.We shall first send a GET request via Postman on a mock API URL and observe the Response body.ExampleCode Implementationimport org.testng.annotations.Test; import static io.restassured.RestAssured.*; import io.restassured.RestAssured; import io.restassured.path.json.JsonPath; import io.restassured.response.Response; import io.restassured.response.ResponseBody; import io.restassured.specification.RequestSpecification; public class NewTest { @Test void responseParse() { //base URI with Rest Assured class RestAssured.baseURI = "https://run.mocky.io/v3"; //input details ... Read More

8K+ Views
We can validate XML response in Rest Assured. For obtaining an XML response, we have to pass the parameter ContentType.XML to the accept method. We shall first send a GET request via Postman on a mock API URL.Using Rest Assured, we shall validate its XML Response containing the name of the subjects Rest Assured, Postman, and their prices 10 and 6 respectively.In the above XML Response, we shall obtain the values of the name and price tags by traversing the paths - courses.subject.name and courses.subject.price respectively.We shall perform the assertion with the help of the Hamcrest framework which uses the ... Read More

3K+ Views
We can validate the response time of a request in Rest Assured. The time elapsed after a request is sent to the server and then receiving the response is known as the response time.The response time is obtained in milliseconds by default. To validate the response time with Matchers, we need to use the below-overloaded methods of the ValidatableResponseOptions −time(matcher) - it verifies the response time in milliseconds with the matcher passed as a parameter to the method.time(matcher, time unit) - it verifies the response time with the matcher and time unit is passed as parameters to the method.We shall ... Read More

7K+ Views
We can get the response time of a request in Rest Assured. The time elapsed after a request is sent to the server and then receiving the response is known as the response time.The response time is obtained in milliseconds by default. However, we can also obtain in other time units. The below methods of the ResponseOptions interface can be used to get the response time −getTime - it gets the response time in milliseconds.getTimeIn(time unit) - it gets the response time in the time unit passed as a parameter to this method.time() - it gets the response time in ... Read More

2K+ Views
A PUT request is used to pass data to the server for the creation or modification of a resource. The difference between POST and PUT is that POST request is not idempotent.This means invoking the same PUT request numerous times will always yield the same output. But invoking the same POST request numerous times will create a similar resource more than one time.The status codes for PUT requests are −200 - request is successful along with modification in the Response body.400 - request is unsuccessful.204 - request is successful without content.ExampleCode Implementationimport org.testng.annotations.Test; import static io.restassured.RestAssured.*; import io.restassured.RestAssured; public class ... Read More

341 Views
The agg() method in pandas Series is used to apply one or more functions on a series object. By using this agg() method we can apply multiple functions at a time on a series.To use multiple functions at once we need to send those function names as a list of elements to the agg() function.Example# import pandas package import pandas as pd # create a pandas series s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) print(s) # Applying agg function result = s.agg([max, min, len]) print('Output of agg method', result)ExplanationThe object “s” has 10 ... Read More