Found 871 Articles for Automation Testing

Where to find Selenium Webdriver release notes?

Debomita Bhattacharjee
Updated on 30-Nov-2020 11:02:41

74 Views

We can find the release notes of Selenium webdriver. They reside within the source control under the specific folder for the particular language libraries. Follow the steps one by one −Navigate to the link − http://docs.seleniumhq.org/.Click on the Download tab.Move to the Selenium Client & WebDriver Language Binding section.Click on the Change Log link for each of the languages.

Getting Selenium to pause for X seconds.

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:58:55

2K+ Views

We can get Selenium to pause for X seconds with the concept of synchronization. There are two types of waits − implicit and explicit. Apart from this there is the Thread.sleep method that halts Selenium for a certain time. The wait time is passed as an argument to the method.ExampleCode Implementation with Thread.sleep.import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class ThreadWt{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       driver.get("https://www.tutorialspoint.com/index.htm");       // identify element, enter text     ... Read More

Use of 'ClickAt ' selenium command.

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:58:01

2K+ Views

We can use the ClickAt command in Selenium IDE. The ClickAt command has two arguments − the element locator and the coordinates which mentions the x and y coordinates of the mouse with respect to the element identified by the locator.This method is used when we want to click on a position having a specific mouse coordinate. It can click on a checkbox, radio button or link.SyntaxclickAt(locator, coordinates)In the Selenium IDE, Choose a row inside the test script edit box. Enter click at the Command field. To identify the dropdown with the id locator, enter the Target field. The x ... Read More

How to scroll down using Selenium WebDriver with Java?

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:55:10

2K+ Views

We can scroll down with Selenium. Selenium is unable to handle scrolling directly. It takes the help of the Javascript Executor to perform the scrolling action up to an element.First of all we have to locate the element up to which we have to scroll to. Next, we shall use the Javascript Executor to run the Javascript commands. The method executeScript is used to run Javascript commands in Selenium. We shall take the help of the scrollIntoView method in Javascript and pass true as an argument to the method.SyntaxWebElement elm = driver.findElement(By.name("name")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", elm);Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; ... Read More

How to set Google Chrome in WebDriver?

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:52:39

491 Views

We can set Google Chrome in Selenium. Java JDK, Eclipse and Selenium webdriver should be configured in the system before setting up the Chrome browser.Steps to set Google Chrome are −Navigate to the link: https://chromedriver.chromium.org/downloads.Select the Chrome driver link which matches with the Chrome browser in the local system.Then, we have to select 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 Environment Variables. Go to ... Read More

How to simulate Print screen button using selenium webdriver in Java?

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:50:15

365 Views

We can simulate a Print screen button with Selenium. The screenshot is captured with the Print screen button. Capturing a screenshot is a three way process. It is an important step towards failure analysis.We shall convert the driver object to TakeScreenshot interface.SyntaxTakesScreenshot s = (TakesScreenshot)driver;Then, with the getScreenshotAs method we shall have an image file and copy that file to a location with FileUtils.copyFile method.SyntaxFile sp=s.getScreenshotAs(OutputType.FILE); FileUtils.copyFile(sp, new File("path of image file"));Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.apache.commons.io.FileUtils; import java.io.File; public class PrintScreenSimulate {    public static void main(String[] args) {     ... Read More

Clear browser Cookies with Selenium WebDriver Java bindings.

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:49:08

528 Views

We can clear browser cookies in Selenium. The method deleteCookieNamed shall delete a cookie with a specific name. The cookie named is passed as an argument to the method. First, we will add a cookie, then get it and finally delete it.Syntaxdriver.manage().deleteCookieNamed("foo");Another method called the deleteAllCookies deletes all cookies from the existing domain. First, we will add the cookies, then get and delete them.Syntaxdriver.manage().deleteAllCookies();Exampleimport java.util.Set; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class DeleteCookiesViaName{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();   ... Read More

Delete Cookies On All Domains using Selenium Webdriver.

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:46:54

2K+ Views

We can delete cookies on all domains with Selenium. The method deleteAllCookies is used to delete all cookies from the present domain. First, we shall add cookies, then get them and finally delete all the cookies.Syntaxdriver.manage().deleteAllCookies();Exampleimport java.util.Set; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class DeleteCookies{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       driver.get("https://www.tutorialspoint.com/index.htm");       // wait of 4 seconds       driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);       // setting name and value for cookie     ... Read More

How to install Selenium in a conda environment?

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:45:28

739 Views

We can install Selenium in a conda environment. The conda has multiple channels to find packages. We have to search for a package which is compatible with our operating system.All the packages shall be available in the link −https://anaconda.org/search?q=selenium&sort=ndownloads&sort_order=−1&reverse=trueOut of all the packages, the most popular and downloaded one is available in the link −https://anaconda.org/conda-forge/seleniumTo install this package, execute any one of the following commands −

How to open a link in new tab using Selenium WebDriver?

Debomita Bhattacharjee
Updated on 30-Nov-2020 10:42:48

9K+ Views

We can open a link in the new tab with Selenium. . The methods Keys.chord and sendKeys can be used for this. The Keys.chord method allows you to pass multiple keys simultaneously.We shall send Keys.CONTROL and Keys.ENTER as arguments to the Keys.chord method. Then the complete string is then passed as an argument to the sendKeys method. Finally, the sendKeys method has to be applied on the link which is identified by driver.findElement method.SyntaxString clicklnk = Keys.chord(Keys.CONTROL, Keys.ENTER); driver.findElement(By.xpath("//*[text()='Privacy Policy']")). sendKeys(clicklnk);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; public class OpenInNwTab{    public static void main(String[] args) { ... Read More

Advertisements