Found 871 Articles for Automation Testing

How to close the pop up window in selenium running?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:42:57

6K+ Views

We can close the pop up window with Selenium. The getWindowHandles and getWindowHandle methods are used for the pop up window. To store all the window handles opened in a Set data structure, the getWindowHandles method is used.To store the window handle of the pop up in focus, the getWindowHandle method is used. To iterate over the window handles, the iterator method is used. By default, the Selenium driver has the control over the parent window.To switch the focus of the driver to the child pop up window, we can take the help of the switchTo().window method. The window handle ... Read More

How do you check scroll position using selenium?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:41:25

3K+ Views

We can check scroll position using Selenium. To check the position we shall use the Javascript executor. We have to verify the value of the window.pageYOffset in the browser.While the URL is launched, the scroll is at the top the value of window.pageYOffset is 0. As we scroll to an element, the value of the window.pageYOffset shall be greater than 0.SyntaxJavascriptExecutor j = (JavascriptExecutor) driver; Long v = (Long) j.executeScript("return window.pageYOffset;");Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.JavascriptExecutor; public class ScrollPosition{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); ... Read More

How to launch Chrome Browser via Selenium?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:40:16

17K+ Views

We can launch Chrome browser via Selenium. Java JDK, Eclipse and Selenium webdriver should be installed in the system before Chrome browser is launch.Follow the steps one by one to launch Chrome −Navigate to the link: https://chromedriver.chromium.org/downloads.Select the Chrome driver link which matches with the Chrome browser in our system.Next, we have to choose and click on the Chrome driver link which is compatible with the operating system we are using.A zip file gets downloaded. Extract and save the chromedriver.exe file in a location.We can configure the chromedriver.exe file in the following ways −By setting the System Properties in the ... Read More

How do you get selenium to recognize that a page loaded?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:38:25

8K+ Views

We can get Selenium to recognize that a page is loaded. We can set the implicit wait for this purpose. It shall make the driver to wait for a specific amount of time for an element to be available after page loaded.Syntaxdriver.manage().timeouts().implicitlyWait();After the page is loaded, we can also invoke Javascript method document.readyState and wait till complete is returned.SyntaxJavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("return document.readyState").toString().equals("complete");After this, verify if the URL matches the one we are looking for.ExampleCode Implementation with implicit wait.import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class Pageload{    public static void main(String[] args) {   ... Read More

How to verify specific text exists within an attribute in Selenium IDE?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:36:20

2K+ Views

We can verify specific text exists with an attribute in Selenium IDE. This can be done using the assert and verify commands −assert element present − Verifies if the element exists on the page. If assertion fails, the test terminates. It has the element locator as an argument.For example −assert element not present − Verifies if the element does not exist on the page. If assertion fails, the test terminates. It has the element locator as an argument.verify element present − Verifies if the element exists on the page. It has the element locator as an argument.verify element not present ... Read More

How to select value from a drop down using Selenium IDE?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:34:37

2K+ Views

We can select value from a dropdown using Selenium IDE. The select command is used for this purpose. First of all, Selenium IDE add-on should be installed in Firefox.Launch Firefox and select the Tools menu. Then choose Selenium IDE.Selenium IDE window shall open. Choose the first row inside the test script edit box.Enter select in Command field. To identify the dropdown with the id locator, enter the Target field. The value/index of the option to be selected is to be entered inside the Value field.Once done, click on the Run option.

The Architecture of Selenium WebDriver.

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:31:31

588 Views

The architecture of Selenium webdriver are illustrated below −Image source:https://www.tutorialspoint.com/what−is−web−driver−in−seleniumSelenium webdriver has the following units −Selenium Binding Languages − Selenium can work on various libraries like Java, Python, Ruby, and so on. It has the language bindings for more than one language.JSON Wire Protocol − JSON is Javascript Object Notion. It is used for transferring data from the server to the client on the web page. It is based on the Rest API that transmits information among HTTP servers.Browser Driver − All the browsers have a specific browser driver. They interact with the browsers (hiding the logic of browser functionality). ... Read More

What is WebDriver in Selenium?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:30:18

947 Views

The webdriver in Selenium is an automation framework used to carry out testing in the web in multiple browsers. It can support more than one operating system as well. It comes with no cost.Selenium can used with languages like −JavaPythonC#Ruby.NetPHPSelenium webdriver can be used HTMLUnit browsers which are headless in nature. Thus the execution can happen in invisible mode without a GUI. The headless execution is preferred as it consumes less resources.Selenium can be used with browsers like −ChromeFirefoxSafariIEHeadless modeEdgeThe structure of webdriver is illustrated below −As a test script is executed, a HTTP request is generated for every command ... Read More

How do I download Selenium RC?

Debomita Bhattacharjee
Updated on 28-Nov-2020 13:29:00

598 Views

We can download Selenium RC by downloading the Java jar file − selenium−server−standalone.jar. We have to download and extract the zip file to do the actual installation.Using the Java Client Driver, the installation can be done by the below steps −To run the Selenium RC server, Java should be installed properly and the path of the environment variable correctly set. To check if Java is installed run the command −java −versionNavigate to the link: https://www.selenium.dev/downloads/ and download the Selenium java client driver zip file.Then the selenium−java jar file is to be extracted.Open an IDE say, Eclipse.Create a Java project.Associate the ... Read More

How to simulate pressing enter in html text input with Selenium?

Debomita Bhattacharjee
Updated on 26-Oct-2020 07:33:51

615 Views

We can simulate pressing enter in the html text input box with Selenium webdriver. We shall take the help of sendKeys method and pass Keys.ENTER as an argument to the method. Besides, we can pass Keys.RETURN as an argument to the method to perform the same task.Also, we have to import org.openqa.selenium.Keys package to the code for using the Keys class. Let us press ENTER/RETURN after entering some text inside the below input box.ExampleCode Implementation with Keys.ENTER.import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; import org.openqa.selenium.Keys; public class PressEnter{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", ... Read More

Advertisements