Found 161 Articles for Rest Assured

What is Test Driven Development?

Debomita Bhattacharjee
Updated on 18-Nov-2021 12:21:11

201 Views

Test-Driven Development is also known as the TDD. It consists of the below steps to be followed one-by-one −Step 1− Create a Test.Step 2− Verify if the test fails.If the test passes, create the second test.If the test fails, then move to Step 3.Step 3− Fix the test to make it pass.If the test passes, move to Step 4.If the test fails, then jump to Step 3.Step 4− Start code refractor and redo all the above steps till the development is done.Benefits of TDDThe benefits of TDD are listed below −The developer is required to apprehend the requirements to know ... Read More

Explain a Step Definition in SpecFlow.

Debomita Bhattacharjee
Updated on 18-Nov-2021 12:19:32

1K+ Views

To execute the Feature file, we must add the implementation logic for each of the steps. To add the definition of the step in SpecFlow, the C# language is used. Thus, a Step Definition File contains methods developed in C# within a Class.The methods have annotations along with a pattern to connect the Step Definition to every matching step. SpecFlow shall run the code to execute the keywords in Gherkin.A Step Definition file is a link between the application interface and Feature File. For providing readability features, the Step Definition File can have parameters. This signifies that it is not ... Read More

Explain a Feature file in SpecFlow.

Debomita Bhattacharjee
Updated on 18-Nov-2021 12:15:37

2K+ Views

The SpecFlow test execution begins from the Feature File. Here all the Features and their corresponding Scenarios are explained in plain text. It has a dual role of serving as an automation element as well as for documentation. A Feature File consists of one or more Scenarios in form of a list.Feature File CreationOnce a SpecFlow project is created, go to the Solution Explorer, and expand it.Right-click on the Features folder. Click on Add, then select the option New Item.Add New Item pop-up comes up. Type SpecFlow Feature in the search box. Select the option SpecFlow Feature File from the ... Read More

How to handle frame in WebDriver?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:51:05

249 Views

We can handle frames in Selenium webdriver. The frames in an html code are represented by the frames/iframe tag. Selenium can handle frames by switching the webdriver access from the main page to the frame.Methods to handle frames are listed below −driver.switch_to_frame("frame name") - frame name is the name of the frame.driver.switch_to_frame("framename.0.frame1") - used to access the subframe in a frame by separating the path with a dot. Here, it would point to the frame with the name frame1 which is the first sub-frame of the frame named framename.driver.switch_to_default_content() - used to switch the webdriver access from a frame to ... Read More

Get text using selenium web driver in python?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:41:05

420 Views

We can get text using Selenium webdriver in Python. This is done with the help of a text method. It fetches the text in an element that can be later validated.First, we need to identify the element with the help of any locators. Suppose we want to get the text - You are browsing the best resource for Online Education on the page below.ExampleCode Implementation.from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # maximize with maximize_window() driver.maximize_window() driver.get("https://www.tutorialspoint.com/index.htm") # identify element l=driver.find_element_by_css_selector("h4") # get text and print print("Text is: " + l.text) driver.close()OutputRead More

How to use MSTest Annotations in specflow c#?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:37:49

431 Views

We can use MSTest annotations in SpecFlow C# in hooks. Hooks are event bindings to add more automation logic at certain steps. For example, for any step which is needed to be run before a specific Scenario. To introduce hooks in the code we have to add the [Binding] attribute.Hooks have global access. But it can be made available to Features and Scenarios by declaring a scoped binding. The scoped binding can be filtered with the tags.SpecFlow+ Runner LimitationsIf we are executing tests from more than one thread with SpecFlow+ Runner, the After and Before hooks like the BeforeTestRun and ... Read More

How to scroll the Page up or down in Selenium WebDriver using java?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:29:01

6K+ Views

We can scroll the page up or down in Selenium webdriver using Java. This is achieved with the help of the Actions class. First of all, we have to create an object of this Actions class and then apply the sendKeys method to it.Now, to scroll down a page, we have to pass the parameter Keys.PAGE_DOWN to this method. To again scroll up a page, we have to pass the parameter Keys.PAGE_UP to the sendKeys method. Finally, we have to use the build and perform methods to perform this action.Syntax −Actions a = new Actions(driver); //scroll down a page a.sendKeys(Keys.PAGE_DOWN).build().perform(); ... Read More

What is Stale Element Reference Exception in Selenium Webdriver & How To Fix It?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:25:24

1K+ 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

How can I manually set proxy settings in Python Selenium?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:18:52

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

How to use a specific chrome profile in selenium?

Debomita Bhattacharjee
Updated on 18-Nov-2021 11:17:05

13K+ 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

Advertisements