- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 871 Articles for Automation Testing
202 Views
We can use Selenium with Python. First, we have to install Python in our system. Navigate to the link: https://www.python.org/downloads/. Click on Download Python .Based on our operating system, we have the options to download Python on Windows, Linux/Unix, Mac, and so on. After clicking the button, the Python executable file needs to be saved to a location.Then click on Install Now and proceed with the installation process.As the installation is done, the Python gets downloaded in the following location −C:\Users\\AppData\Local\Programs\Python\Next, we have to set the location of the Python folder in the Environmental variables. Also, the path of the ... Read More
2K+ Views
We can check the URL for 404 using Selenium webdriver. A 404 check is actually done to verify if there are broken links in a page. On clicking such a link, we shall not be directed to the correct page.A broken link can occur due to the following reasons −The landing page is no longer available.Some parts of the URL have been modified.An incorrect URL has been specified on the page.Firewall or geolocation limitations.A URL can have the following status code −5XX − Represents issue in server.4XX − Represents resource cannot be determined.3XX − Represents redirection.2XX − Represents correct condition.Thus ... Read More
5K+ Views
We can use Selenium with Chromium browser. Prior to working with Chrome with Selenium, we should have the Java JDK, a Java IDE and Selenium webdriver configured in our system. Then, we must download the chromodriver.exe file and set it up in our project with the below steps −Visit the link: https://chromedriver.chromium.org/downloads. There shall be links available for download for various chromedriver versions.Select the version which is compatible with the Chrome available to our system. Click on it. As the following page is navigated, select the zip file available for download for various operating systems (Linux, windows). Choose the one ... Read More
1K+ Views
We can take screenshots of the options in dropdown with Selenium Webdriver. A screenshot is generally captured for the failure test cases. This is achieved with the help of ITakesScreenshot interface.We shall take the help of GetScreenshot method to grab the screenshot. Finally, the SaveAsFile method is used where we pass the parameters – the path of the file and format of the image.Syntax((ITakesScreenshot)d). GetScreenshot().SaveAsFile("Screenshot.png", ScreenshotImageFormat.Png);For implementation we shall be using the NUnit framework.Exampleusing NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System; namespace NUnitTestProject1{ public class Tests{ String u ="https://www.tutorialspoint.com/selenium/selenium_automation_practice.htm"; IWebDriver d; ... Read More
5K+ Views
We can connect to an already open browser using Selenium webdriver. This can be done using the Capabilities and ChromeOptions classes. The Capabilities class obtains the browser capabilities with the help of the getCapabilities method.This is generally used for debugging purposes when we have a large number of steps in a test and we do not want to repeat the same steps. First of all we shall launch the browser and enter some text in the below edit box.Exampleimport 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 ConnectBrwSession{ public static void main(String[] ... Read More
978 Views
We can find an element by partial is with Selenium in C#. This can be done as we identify elements with the locator's CSS and xpath. The regular expression is used to find the partially matched element.Let us investigate the id attribute of an element having value as gsc−i−id1.In xpath, we utilize the contains() function for partial matching. So, here xpath expression shall be //*[contains(@id, 'id')]. This is because the subtext id is within the text gsc−i−id1. We can also take the help of the starts−with() function. So, the xpath expression becomes //*[starts−with(@id, 'gsc')] as the text gsc−i−id1 starts with ... Read More
2K+ Views
We can get all options in a drop−down list by Selenium Webdriver in C#. The static drop−down in an html code is identified with a select tag. All the options for a drop−down have the option tag.To obtain all the options in the form of a list, we shall first identify that element with the help of any of the locators like id, xpath, name, and so on. Then we must create an object of the SelectElement class and apply Options method on it.Let us investigate the html code of drop−down.For implementation we shall be using the NUnit framework.Exampleusing NUnit.Framework; ... Read More
4K+ Views
We can check if element exists with Selenium webdriver in C#. This can be determined with the help of the FindElements method. It returns a list of elements which matches the locator passed as a parameter to that method.If there are no matching elements, an empty list is obtained. In case we have used the method FindElement instead of FindElements, NoSuchElementException will be thrown if there are no matching elements.For implementation we shall be using the NUnit framework.Exampleusing NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Firefox; using System; using System.Collections.Generic; namespace NUnitTestProject1{ public class Tests{ String u ... Read More
473 Views
We can use Selenium in C#. We should have Visual Studio 2019 installed in the system along with Selenium webdriver and any browser like Firefox, Chrome, and so on. Then we must utilize the NUnit framework.Launch Visual Studio 2019 and then click on Create a new project.Type NUnit in the search box appearing in Create a new project pop−up. Select NUnit Test Project(.NET Core) from the search results.Enter Project name and Location. Then click on Create to proceed.As the project is set up on NUnit(.Net Core), the Setup and Test methods shall be given by default.We should navigate to the ... Read More
4K+ Views
We can scroll to an element with Selenium webdriver in C#. This is done with the help of JavaScript Executor. Selenium can run JavaScript commands with the help of ExecuteScript method.The method scrollIntoView in JavaScript is used to perform the scrolling action and the value true is passed as a parameter to the method. This is then passed to the ExecuteScript method.Syntaxvar e = driver.FindElement(By.XPath("//*[text()='Careers']")); ((IJavaScriptExecutor)driver) .ExecuteScript("arguments[0].scrollIntoView(true);", e);For implementation we shall be using the NUnit framework.Exampleusing NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System; namespace NUnitTestProject1{ public class Tests{ String u = "https://www.tutorialspoint.com/index.htm"; IWebDriver ... Read More