Found 871 Articles for Automation Testing

Automated Software Testing with SpecFlow in Selenium

Debomita Bhattacharjee
Updated on 07-Apr-2021 09:03:56

285 Views

We can have automated software testing with SpecFlow by configuring Selenium in C#. We will use the Visual Studio editor, to develop the Selenium tests using the NUnit framework. Click on Create a new project from the Visual Studio welcome page.Enter NUnit in the search edit box within the Create a new project window. Then choose the option NUnit Test Project(.NET Core) from the result dropdown. Click on Next to proceed.Populate the Project name, Location and click on Create.Once the project is successfully configured, the Setup and Test methods are provided automatically along with the import statement - using NUnit.Framework.Then ... Read More

How can I verify Error Message on a webpage using Selenium Webdriver?

Debomita Bhattacharjee
Updated on 07-Apr-2021 09:01:10

7K+ Views

We can verify error messages on a webpage using Selenium webdriver using the Assertion. In case, the actual and expected values do not match, an Assertion Error is thrown.Let us try to verify the highlighted error message.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; import org.testng.Assert; public class VerifyErrorMsg{    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 launch       driver.get("https://www.linkedin.com/");   ... Read More

Handling DropDown And Multiple Select in Webdriver using Selenium

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:57:44

13K+ Views

We can handle multi-select dropdown with Selenium webdriver using the Select class. A multi-select dropdown is the one which allows selection of multi options.The Select methods to handle multi-select dropdown are listed below −getOptions – returns the list of all options in the dropdown.Select s = new Select(e); List l = s.getOptions();getFirstSelectedOption– returns the selected option in the dropdown. If there are multi options selected, only the first item shall be returned.Select s = new Select(e); l = s. getFirstSelectedOption();isMultiple – returns a boolean value, yields a true value if the dropdown allows selection of multiple items.Select s = new ... Read More

What is Selenium Internet Explorer Driver or IE Driver?

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:51:46

319 Views

Selenium Internet Explorer Driver is used to execute test cases in the Internet Explorer browser. It is a standalone server that establishes a link between our Selenium test and the Internet Explorer browser.We can download the Internet Explorer Driver file from the below link − https://www.selenium.dev/downloads/Select and click on the download link which is compatible with our local operating system. As the download is done successfully, a zip file gets created. We have to unzip it and save the executable file - IEDriverServer.exe in a location.Next, we shall set the path of the IEDriverServer.exe file using the System.setProperty method. We ... Read More

Selenium with C Sharp - How to perform Explicit Wait method?

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:50:24

2K+ Views

We can perform explicit wait with Selenium webdriver in C#. This is done to achieve synchronization between our tests and the elements on the page. For implementation of explicit wait, we have to take the help of the WebDriverWait and ExpectedCondition classes.We shall create an object of the WebDriverWait class. The webdriver waits tillspecified wait time waiting for the expected condition for an element is satisfied.After the time has elapsed, an exception is raised by Selenium.The explicit waits are dynamic in nature which means if we have an explicit wait of five seconds and the expected condition is met at ... Read More

How to do DataDriven testing in specflow api using Selenium?

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:48:49

173 Views

We can do data driven testing in SpecFlow with/without the Examples keyword. In case we are not using the keyword Examples, then we have to send the data from the steps (enclosed in '') in the Feature file.Feature File ImplementationFeature: Launching application Scenario: Launch URL Given User hits URL 'https://www.tutorialspoint.com/index.htm'ExampleStep Definition File Implementationusing System; using TechTalk.SpecFlow; namespace SpecFlowProject1.Features{    [Binding]    public class LaunchingApplicationSteps{       [Given(@"User hits URL '(.*)'")]       public void GivenUserHitsURL(string url){          Console.WriteLine(url);       }    } }OutputNext, we will perform the data driven testing using the Examples ... Read More

C Sharp with Selenium - How to Switch one tab to another tab in Csharp Selenium?

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:47:13

5K+ Views

We can switch one tab to another tab with Selenium webdriver in C#.Sometimes on clicking a link or a button, we can have multiple tabs opened in the same browser.By default, the webdriver can access only the parent tab. To access the second tab, we have to switch the driver focus with the help of the SwitchTo().Window() method. The window handle id of the tab where we want to switch to is passed as a parameter..The method CurrentWindowHandle yields the window handle id of the tab which is in focus. The WindowHandles method returns all the window handle ids of ... Read More

C# and Selenium: Wait Until Element is Present

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:45:02

6K+ Views

We can wait until an element is present in Selenium webdriver using the explicit wait. It is mainly used whenever there is a synchronization issue for an element to be available on page.The WebDriverWait and the ExpectedCondition classes are used for an explicit wait implementation. We have to create an object of the WebDriverWait which shall invoke the methods of the ExpectedCondition class.The webdriver waits for a specified amount of time for the expected criteria to be met. After the time has elapsed, an exception gets thrown. To wait for an element to be present, we have to use the ... Read More

How to set Page Load Timeout using C# using Selenium WebDriver?

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:39:38

2K+ Views

We can set page load timeout using Selenium webdriver in C# using the PageLoad method. It is used to set time to wait for loading of the page. An exception will be thrown if the page is not loaded within the timeout specified.Syntaxdriver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(10);Here, 10 is the amount of time in seconds.Exampleusing NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System; using OpenQA.Selenium; namespace NUnitTestProject2{    public class Tests{       String url = "https://www.tutorialspoint.com/index.htm";       IWebDriver driver;       [SetUp]       public void Setup(){          //creating object of FirefoxDriver     ... Read More

Moving mouse pointer to a specific location or element using C# and Selenium

Debomita Bhattacharjee
Updated on 07-Apr-2021 08:38:51

6K+ Views

We can move mouse pointer to a specific location or element in Selenium webdriver(C#) using the Actions class. We have to first create an object of this class.Next to move an element we have to apply the MoveToElement method and pass the element locator as a parameter to this method. Finally, to actually perform this task the method Perform is to be used.After moving to an element, we can click on it with the Click method. To move to a specific location, we have to use the MoveByOffset method and then pass the offset numbers to be shifted along the ... Read More

Advertisements