This repository includes selenium web driver tests examples using spring boot application.

Overview

Selenium Web Driver Tests

CircleCI

This repository includes selenium tests examples using custom spring boot application.

Overview

Run tests

  1. Download ChromeDriver
  • Check your local Chrome browser version and download corresponding chromedriver version

  • Create the following folder structure

mkdir -p /tmp/chromedriver
  • Unzip downloaded archive
unzip chromedriver_mac64.zip
  • Move chromedriver to the /tmp/chromedriver location
mv ~/Downloads/chromedriver /tmp/chromedriver/
  1. Clone this repository
git clone https://github.com/vznd/selenium-webdriver-tests.git
  1. Move to a project directory
cd selenium-webdriver-tests
  1. Run spring boot application
mvn spring-boot:run &
  1. Run tests
mvn test

Additional Information

The 3rd version of selenium is used because the 4th one is in conflict with the Sprint Boot dependencies.

Selenium Configurations, Features and Methods

All information is gathered from an official selenium website.

Install a Selenium Library

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>${version}</version>
</dependency>

Install browser drivers

  • [Out of scope] Install driver with WebDriverManager software

  • [Out of scope] The PATH Environment Variable

  • [Covered] Hard Coded Location. In this repository the PATH to driver is hardcoded in system variable, in pom.xml:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <configuration>
                <systemPropertyVariables>
                    <webdriver.chrome.driver>/path/to/driver</webdriver.chrome.driver>
                </systemPropertyVariables>
            </configuration>
        </plugin>
    </plugins>
</build>

Shared capabilities

Not all the shared capabilities are used in this project. But the reference is provided for all available below. Please, check an official documentation for details.

Getting browser information

  • [Covered] Get a web page title. Returns String
driver.getTitle();
  • [Covered] Get a web page URL. Returns String
driver.getCurrentUrl();

Browser navigation

  • [Covered] Open a web URL at wikipedia.org
driver.get("https://www.wikipedia.org/");
  • [Covered] A bit longer way to open a web URL at wikipedia.org
driver.navigate().to("https://www.wikipedia.org/");
  • [Covered] Press a back browser button
driver.navigate().back();
  • [Covered] Press a forward browser button
driver.navigate().forward();

Alerts

Alerts are not covered as of now. Should be covered.

  • [Covered] Store Alert in a variable using WebDriverWait. Please refer to Waits section for more information about Waits
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(1)); // Create wait variable
Alert alert = wait.until(ExpectedConditions.alertIsPresent()); // Get an alert and store to variable
  • [Covered] There is no ExpectedCondition like "alertIsNotPresent()". So, to check that there is no alert, you can implement helper
public boolean isAlertPresent() {
    try {
        driver.switchTo().alert();
        return true;
    } catch (NoAlertPresentException e) {
        return false;
    }
}
  • [Covered] Store Alert in a variable using driver
Alert alert = driver.switchTo().alert();
  • [Covered] Get Alert text
alert.getText();
  • [Covered] Press OK button in the alert
alert.accept();
  • [Covered] Press Cancel button in the alert
alert.dismiss();
  • [Covered] Enter some information to a Prompt alert
Alert alert = driver.switchTo().alert(); // Firstly, get the Alert and store in variable
alert.sendKeys("Denny") // Secondly, enter the text
alert.accept(); // Thirdly, press OK button

Cookies

  • [To cover] Create a cookie object and store it to a variable
Cookie cookie = new Cookie("key", "value");
  • [To cover] Add a cookie
driver.manage().addCookie(new Cookie("key", "value"));
  • [To cover] Get a cookie by name and store it to a variable
Cookie cookie = driver.manage().getCookieNamed("key");
  • [To cover] Get all cookies and store it to a variable
Set<Cookie> cookies = driver.manage().getCookies();
  • [To cover] Delete a cookie by name
driver.manage().deleteCookieNamed("key");
  • [To cover] Delete a cookie by Cookie object
Cookie cookie = new Cookie("key", "value"); // Create a cookie
driver.manage().addCookie(cookie); // Add a cookie
// make some actions here
driver.manage().deleteCookie(cookie); // Delete a cookie
  • [To cover] Delete all cookies
driver.manage().deleteAllCookies();
  • [Out of scope] Managing a Same-Site cookie attribute

Frames

  • [Covered] Switch to Frame using WebElement
WebElement iframe = driver.findElement(By.cssSelector("#modal>iframe")); // Store the web element
driver.switchTo().frame(iframe); // Switch to the frame
  • [Covered] Switch to Frame using id
driver.switchTo().frame("buttonframe"); // Using the ID, the same syntax for using the name selector
  • [Covered] Switch to Frame using name
driver.switchTo().frame("firstframe"); 
  • [Covered] Switch to Frame using and index
driver.switchTo.frame(1);
  • [Covered] Leave a frame
driver.switchTo().defaultContent();

Windows

WebDriver does not make the distinction between windows and tabs. If your site opens a new tab or window, Selenium will let you work with it using a window handle. Each window has a unique identifier which remains persistent in a single session.

  • [Covered] Get original window identifier and put it to a variable
String originalWindow = driver.getWindowHandle();
  • [Covered] Get all opened windows identifiers and store it to a variable
Set<String> allWindows = driver.getWindowHandles();
  • [Covered] Switch to a different window handle
driver.switchTo().window(windowHandleId); // where windowHandleId is a String with handleId 
  • [Covered] Wait for certain amount of windows to be opened
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(1)); // Define a WebDriverWait
ExpectedCondition<Boolean> expectedCondition = numberOfWindowsToBe(2); // Define expected condition calling numberOfWindowsToBe static method
wait.until(expectedCondition); // Perform wait until expected condition
  • [Out of scope] Create a new window switching to a new tab
driver.switchTo().newWindow(WindowType.TAB);
  • [Out of scope] Create a new window switching to a new window
driver.switchTo().newWindow(WindowType.WINDOW);
  • [Covered] Close the tab or window
driver.close();
  • [Covered] Get window size / dimensions individually
int width = driver.manage().window().getSize().getWidth();
int height = driver.manage().window().getSize().getHeight();
  • [Covered] Store dimensions in a variable and query them from the object
Dimension size = driver.manage().window().getSize();
int width = size.getWidth();
int height = size.getHeight();
  • [Covered] Set window size
Dimension dimension = new Dimension(1024, 768); // Create a new dimension object with specified height and width
driver.manage().window().setSize(dimension); // Set window size
  • [Covered] Get window position / x, y coordinates individually
int x = driver.manage().window().getPosition().getX();
int y = driver.manage().window().getPosition().getY();
  • [Covered] Store window position in a variable and query x, y coordinates from the object
Point position = driver.manage().window().getPosition();
int x1 = position.getX();
int y1 = position.getY();
  • [Covered] Set window position
Point position = new Point(0, 0); // Create a new position object with specified x and y
driver.manage().window().setPosition(position); // Set position
  • [Covered] Maximize window
driver.manage().window().maximize();
  • [Out of scope] Minimize window
driver.manage().window().minimize();
  • [Covered] Enter fullscreen
driver.manage().window().fullscreen();
  • [Covered] Take a screenshot of a window
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); // Take a screenshot 
FileUtils.copyFile(scrFile, new File("./image.png")); // Store it in the root directory with image.png name
  • [Covered] Take a screenshot of an element
WebElement element = driver.findElement(By.cssSelector("h1")); // Find an element
File scrFile = element.getScreenshotAs(OutputType.FILE); // Take a screenshot
FileUtils.copyFile(scrFile, new File("./image.png")); // Store it in the root directory with image.png name
  • [Covered] Execute a JavaScript
JavascriptExecutor js = (JavascriptExecutor)driver; // Define a JavascriptExecutor
js.executeScript("console.log('hello world')"); // Invoke the executeScript method and pass a script as a String argument
  • [Covered] Execute a JavaScript on a WebElement
JavascriptExecutor js = (JavascriptExecutor)driver; // Define a JavascriptExecutor
WebElement button = driver.findElement(By.name("btnLogin")); // Find a web element
js.executeScript("arguments[0].click();", button); // Perform a click on a button with java script
  • [Out of scope] Print page
PrintsPage printer = (PrintsPage) driver; // Define PrintsPage object
PrintOptions printOptions = new PrintOptions(); // Define PrintOptions
printOptions.setPageRanges("1-2"); // Set a range of pages for printing

Pdf pdf = printer.print(printOptions); // Invoke print method and store the result in a Pdf variable
String content = pdf.getContent(); // Invoke a getContent method and store the result in a String variable

Elements

Traditional locators:

Locator Description
class name Locates elements whose class name contains the search value (compound class names are not permitted)
css selector Locates elements matching a CSS selector
id Locates elements whose ID attribute matches the search value
name Locates elements whose NAME attribute matches the search value
link text Locates anchor elements whose visible text matches the search value
partial link text Locates anchor elements whose visible text contains the search value. If multiple elements are matching, only the first one will be selected.
tag name Locates elements whose tag name matches the search value
xpath Locates elements matching an XPath expression

Relative locators:

Examples below with the above, below, left of, right of, near and chaining locators are related to the following image:

  • [Out of scope] Above - find the <input> element which is above the #password element
By emailLocator = RelativeLocator.with(By.tagName("input")).above(By.id("password"));
  • [Out of scope] Below - find the <input> element which is below the #email element
By passwordLocator = RelativeLocator.with(By.tagName("input")).below(By.id("email"));
  • [Out of scope] Left of - find the <button> element which is to the left of the #submit element
By cancelLocator = RelativeLocator.with(By.tagName("button")).toLeftOf(By.id("submit"));
  • [Out of scope] Right of - find the <button> element which is to the right of the #cancel element
By submitLocator = RelativeLocator.with(By.tagName("button")).toRightOf(By.id("cancel"));
  • [Out of scope] Near - find the <input> element which is not more than 50px near the #lbl-email element
By emailLocator = RelativeLocator.with(By.tagName("input")).near(By.id("lbl-email"));
  • [Out of scope] Chaining locators - find the <button> element which below the #email element and to the right of the #cancel element
By submitLocator = RelativeLocator.with(By.tagName("button")).below(By.id("email")).toRightOf(By.id("cancel"));

Finders:

  • [To cover] Find the first element which has a class with name tomatoes
WebElement vegetable = driver.findElement(By.className("tomatoes"));
  • [To cover] Find a web element, based on a parent element using two objects
WebElement fruits = driver.findElement(By.id("fruits")); // Find a fruits element (parent in HTML)
WebElement fruit = fruits.findElement(By.id("tomatoes")); // Find a tomatoes child element from the parent fruits element
  • [To cover] Find a web element, based on a parent element using two locators
WebElement fruit = driver.findElement(By.cssSelector("#fruits .tomatoes"));
  • [To cover] Find all elements on the page which has <li> tag
List<WebElement> plants = driver.findElements(By.tagName("li"));
  • [To cover] Switch to the element which is currently active
driver.switchTo().activeElement().getAttribute("title")

Interactions:

  • [Covered] Click on a web element
buttonElement.click();
  • [Covered] Fill in input filed with the data
inputElement.sendKeys("some-text");
  • [Covered] Clear data in the input filed
inputElement.clear();

Information:

  • [Covered] Check if element is displayed on the page
WebElement loginForm = driver.findElement(By.css("[name='login']")); // Find an element
boolean isFormVisible = loginForm.isDisplayed(); // Invoke isDisplayed method and put it to a variable
  • [To cover] Check if element is enabled
WebElement button = driver.findElement(By.name("btnK")); // Find an element
boolean isButtonVisible = button.isEnabled(); // Invoke isEnabled method and put it to a variable
  • [To cover] Check if element is selected
WebElement checkBox = driver.findElement(By.cssSelector("input[type='checkbox']:first-of-type")); // Find an element
boolean isCheckBoxSelected = checkBox.isSelected(); // Invoke isSelected method and put it to a variable
  • [To cover] Get a tag name from element
WebElement title = driver.findElement(By.cssSelector("h1")); // Find an element
String tagNameValue = title.getTagName(); // Invoke isSelected method and put it to a variable
  • [To cover] Get an element height, width, x and y coordinates in a single object
Rectangle res = driver.findElement(By.cssSelector("h1")).getRect(); // Get Rectangle data and put it to a variable
System.out.println(res.getX()); // Get x coordinate and print it to a console
System.out.println(res.getY()); // Get y coordinate and print it to a console
System.out.println(res.getWidth()); // Get getWidth coordinate and print it to a console
System.out.println(res.getHeight()); // Get getHeight coordinate and print it to a console
  • [To cover] Get CSS value from element
String cssValue = driver.findElement(By.id("login-button")).getCssValue("color");
  • [To cover] Get text from element
String text = driver.findElement(By.cssSelector("h1")).getText();

Select lists:

Consider the html below.

<select id="check-box-list-id">
 <option value=value1>Bread</option>
 <option value=value2 selected>Milk</option>
 <option value=value3>Cheese</option>
</select>
  • [To cover] Initialize select object and store it to a variable
WebElement selectElement = driver.findElement(By.id("check-box-list-id")); // Find a web element
Select selectObject = new Select(selectElement); // Initialize Select object
  • [To cover] Check if multiple options are selected
Boolean doesThisAllowMultipleSelections = selectObject.isMultiple();
  • [To cover] Get all available options and store it to a variable
List<WebElement> allAvailableOptions = selectObject.getOptions();
  • [To cover] Get the first selected option and store it to a variable
WebElement firstSelectedOption = selectObject.getFirstSelectedOption();
  • [To cover] Get all selected options and store it to a variable
List<WebElement> allSelectedOptions = selectObject.getAllSelectedOptions();
  • [To cover] Select option by index
selectObject.selectByIndex(1);
  • [To cover] Deselect option by index
selectObject.deselectByIndex(1);
  • [To cover] Select option by its value
selectObject.selectByValue("value1");
  • [To cover] Deselect option by its value
selectObject.deselectByValue("value1");
  • [To cover] Select option by visible text
selectObject.selectByVisibleText("Bread");
  • [To cover] Deselect option by visible text
selectObject.deselectByVisibleText("Bread");
  • [To cover] Deselect all options
selectObject.deselectAll();

Waits

Waiting is having the automated task execution elapse a certain amount of time before continuing with the next step. To overcome the problem of race conditions between the browser and your WebDriver script, most Selenium clients ship with a wait package. When employing a wait, you are using what is commonly referred to as an explicit wait.

Explicit wait:

Explicit waits allow your code to pause a program execution, until the condition you pass it resolves. The condition is called with a certain frequency until the timeout of the wait is elapsed.

  • [To cover] Initialize a WebDriverWait
WebElement wait = new WebDriverWait(driver, Duration.ofSeconds(10));
  • [To cover] Wait until element becomes clickable
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//a/h3"));  
  • [To cover] Wait until element is found and store it to a variable
WebElement element = new WebDriverWait(driver, Duration.ofSeconds(3))
          .until(driver -> driver.findElement(By.name("q")));

Expected conditions:

Method Description
alertIsPresent() An expectation for checking Alert to present on the page
and(ExpectedCondition<?>... conditions) An expectation with the logical and condition of the given list of conditions
attributeContains(By locator, java.lang.String attribute, java.lang.String value) An expectation for checking WebElement with given locator has attribute which contains specific value
attributeContains(WebElement element, java.lang.String attribute, java.lang.String value) An expectation for checking WebElement with given locator has attribute which contains specific value
attributeToBe(By locator, java.lang.String attribute, java.lang.String value) An expectation for checking WebElement with given locator has attribute with a specific value
attributeToBe(WebElement element, java.lang.String attribute, java.lang.String value) An expectation for checking given WebElement has attribute with a specific value
attributeToBeNotEmpty(WebElement element, java.lang.String attribute An expectation for checking WebElement any non empty value for given attribute
domAttributeToBe(WebElement element, java.lang.String attribute, java.lang.String value) An expectation for checking given WebElement has DOM attribute with a specific value
domPropertyToBe(WebElement element, java.lang.String property, java.lang.String value) An expectation for checking given WebElement has DOM property with a specific value
elementSelectionStateToBe(By locator, boolean selected) An expectation for checking if the given element is selected
elementSelectionStateToBe(WebElement element, boolean selected) An expectation for checking if the given element is selected
elementToBeClickable(By locator) An expectation for checking an element is visible and enabled such that you can click it
elementToBeClickable(WebElement element) An expectation for checking an element is visible and enabled such that you can click it
elementToBeSelected(By locator) An expectation for checking if the given element is selected
elementToBeSelected(WebElement element) An expectation for checking if the given element is selected
frameToBeAvailableAndSwitchToIt(int frameLocator) An expectation for checking whether the given frame is available to switch to
frameToBeAvailableAndSwitchToIt(java.lang.String frameLocator) An expectation for checking whether the given frame is available to switch to
frameToBeAvailableAndSwitchToIt(By locator) An expectation for checking whether the given frame is available to switch to
frameToBeAvailableAndSwitchToIt(WebElement frameLocator) An expectation for checking whether the given frame is available to switch to
invisibilityOf(WebElement element) An expectation for checking the element to be invisible
invisibilityOfAllElements(java.util.List elements) An expectation for checking all elements from given list to be invisible
invisibilityOfAllElements(WebElement... elements) An expectation for checking all elements from given list to be invisible
invisibilityOfElementLocated(By locator) An expectation for checking that an element is either invisible or not present on the DOM
invisibilityOfElementWithText(By locator, java.lang.String text) An expectation for checking that an element with text is either invisible or not present on the DOM
javaScriptThrowsNoExceptions(java.lang.String javaScript) An expectation to check if js executable
jsReturnsValue(java.lang.String javaScript) An expectation for String value from javascript
not(ExpectedCondition<?> condition) An expectation with the logical opposite condition of the given condition
numberOfElementsToBe(By locator, java.lang.Integer number) An expectation for checking number of WebElements with given locator
numberOfElementsToBeLessThan(By locator, java.lang.Integer number) An expectation for checking number of WebElements with given locator being less than defined number
numberOfElementsToBeMoreThan(By locator, java.lang.Integer number) An expectation for checking number of WebElements with given locator being more than defined number
numberOfWindowsToBe(int expectedNumberOfWindows) An expectation for checking number of Windows opened in a current session
or(ExpectedCondition<?>... conditions) An expectation with the logical or condition of the given list of conditions
presenceOfAllElementsLocatedBy(By locator) An expectation for checking that there is at least one element present on a web page
presenceOfElementLocated(By locator) An expectation for checking that an element is present on the DOM of a page
presenceOfNestedElementLocatedBy(By locator, By childLocator) An expectation for checking child WebElement as a part of parent element to present
presenceOfNestedElementLocatedBy(WebElement element, By childLocator) An expectation for checking child WebElement as a part of parent element to be present
presenceOfNestedElementsLocatedBy(By parent, By childLocator) An expectation for checking child WebElement as a part of parent element to present
refreshed(ExpectedCondition condition) Wrapper for a condition, which allows for elements to update by redrawing
stalenessOf(WebElement element) Wait until an element is no longer attached to the DOM
textMatches(By locator, java.util.regex.Pattern pattern) An expectation for checking WebElement with given locator has text with a value as a part of it
textToBe(By locator, java.lang.String value) An expectation for checking WebElement with given locator has specific text
textToBePresentInElement(WebElement element, java.lang.String text) An expectation for checking if the given text is present in the specified element
textToBePresentInElementLocated(By locator, java.lang.String text) An expectation for checking if the given text is present in the element that matches the given locator
textToBePresentInElementValue(By locator, java.lang.String text) An expectation for checking if the given text is present in the specified elements value attribute
textToBePresentInElementValue(WebElement element, java.lang.String text) An expectation for checking if the given text is present in the specified elements value attribute
titleContains(java.lang.String title) An expectation for checking that the title contains a case-sensitive substring
titleIs(java.lang.String title) An expectation for checking the title of a page
urlContains(java.lang.String fraction) An expectation for the URL of the current page to contain specific text
urlMatches(java.lang.String regex) Expectation for the URL to match a specific regular expression
urlToBe(java.lang.String url) An expectation for the URL of the current page to be a specific url
visibilityOf(WebElement element) An expectation for checking that an element, known to be present on the DOM of a page, is visible
visibilityOfAllElements(java.util.List elements) An expectation for checking that all elements present on the web page that match the locator are visible
visibilityOfAllElements(WebElement... elements) An expectation for checking that all elements present on the web page that match the locator are visible
visibilityOfAllElementsLocatedBy(By locator) An expectation for checking that all elements present on the web page that match the locator are visible
visibilityOfElementLocated(By locator) An expectation for checking that an element is present on the DOM of a page and visible
visibilityOfNestedElementsLocatedBy(By parent, By childLocator) An expectation for checking child WebElement as a part of parent element to be visible
visibilityOfNestedElementsLocatedBy(WebElement element, By childLocator) An expectation for checking child WebElement as a part of parent element to be visible

Implicit wait:

By implicitly waiting, WebDriver polls the DOM for a certain duration when trying to find any element.

  • [To cover] Implicit wait
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

Fluent wait:

FluentWait instance defines the maximum amount of time to wait for a condition, as well as the frequency with which to check the condition. Users may configure the wait to ignore specific types of exceptions whilst waiting, such as NoSuchElementException when searching for an element on the page.

  • [To cover] Waiting 30 seconds for an element to be present on the page, checking for its presence once every 5 seconds
Wait<WebDriver> wait = new FluentWait<>(driver)
        .withTimeout(Duration.ofSeconds(30))
        .pollingEvery(Duration.ofSeconds(5))
        .ignoring(NoSuchElementException.class);

WebElement foo = wait.until(driver -> driver.findElement(By.id("foo")));

Actions API

Unlike the high-level element interactions, which conducts additional validations, the Actions API provides granular control over input devices. Selenium provides access to 3 input sources: key inputs for keyboard devices, pointer inputs for a mouse, pen or touch device, and a wheel inputs for scroll wheel support.

Keyboard:

  • [Covered] Enter a "webdriver" text and perform "ENTER" keyboard action
driver.findElement(By.name("q")).sendKeys("webdriver" + Keys.ENTER);
  • [Covered] Perform "ENTER" keyboard action using Actions object
Actions action = new Actions(driver);
action.sendKeys(Keys.ENTER).perform();
  • [Covered] Enters text "qwerty" with keyDown SHIFT key and after keyUp SHIFT key (QWERTYqwerty)
Actions action = new Actions(driver);
WebElement search = driver.findElement(By.name("q"));
action.keyDown(Keys.SHIFT).sendKeys(search,"qwerty").keyUp(Keys.SHIFT).sendKeys("qwerty").perform();

Mouse:

  • [To cover] Click and hold mouse
WebElement searchBtn = driver.findElement(By.linkText("Sign in"));
Actions actionProvider = new Actions(driver);
actionProvider.clickAndHold(searchBtn).build().perform();
  • [To cover] Right click on element
WebElement searchBtn = driver.findElement(By.linkText("Sign in"));
Actions actionProvider = new Actions(driver);
actionProvider.contextClick(searchBtn).build().perform();
  • [To cover] Double click on element
WebElement searchBtn = driver.findElement(By.linkText("Sign in"));
Actions actionProvider = new Actions(driver);
actionProvider.doubleClick(searchBtn).build().perform();
  • [To cover] Move to element - scroll to a view where element is located and move mouse cursor to a middle of this element
WebElement gmailLink = driver.findElement(By.linkText("Gmail"));
Actions actionProvider = new Actions(driver);
actionProvider.moveToElement(gmailLink).build().perform();
  • [Out of scope] Move by offset - move the mouse from its current position (or 0,0) to the element
// Store 'Gmail' anchor web element
WebElement gmailLink = driver.findElement(By.linkText("Gmail"));

// Capture x and y offset positions of element
int xOffset = gmailLink.getRect().getX();
int yOffset = gmailLink.getRect().getY();

Actions actionProvider = new Actions(driver);
// Performs mouse move action onto the offset position
actionProvider.moveByOffset(xOffset, yOffset).build().perform();
  • [Out of scope] DragAndDrop - click and hold the source element, move to the location of the target element and then releases the mouse
WebElement sourceEle = driver.findElement(By.id("draggable"));
WebElement targetEle = driver.findElement(By.id("droppable"));
Actions actionProvider = new Actions(driver);
actionProvider.dragAndDrop(sourceEle, targetEle).build().perform();
  • [Out of scope] DragAndDropBy - click and hold the source element, move to the location of the given offset and then releases the mouse
WebElement sourceEle = driver.findElement(By.id("draggable"));
WebElement targetEle = driver.findElement(By.id("droppable"));
int targetEleXOffset = targetEle.getLocation().getX();
int targetEleYOffset = targetEle.getLocation().getY();

Actions actionProvider = new Actions(driver);
actionProvider.dragAndDropBy(sourceEle, targetEleXOffset, targetEleYOffset).build().perform();
  • [Out of scope] Release - releases the depressed left mouse button. If WebElement is passed, it will release depressed left mouse button on the given WebElement
WebElement sourceEle = driver.findElement(By.id("draggable"));
WebElement targetEle = driver.findElement(By.id("droppable"));

Actions actionProvider = new Actions(driver);
actionProvider.clickAndHold(sourceEle).moveToElement(targetEle).build().perform();
actionProvider.release().build().perform(); 
You might also like...

Two Spring-boot applications registering themselves to an spring-boot-admin-server application as separate clients for the purpose of monitoring and managing the clients

Two Spring-boot applications registering themselves to an spring-boot-admin-server application as separate clients for the purpose of monitoring and managing the clients

Spring-boot-admin implementation with 1 Server and 2 clients Creating a Server application to monitor and manage Spring boot applications (clients) un

Dec 6, 2022

The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker.

gke-springboot-sampleapp 👋 The Spring Boot Sample App on K8S has been implemented using GKE K8S Cluster, Spring Boot, Maven, and Docker. Usage To be

Feb 1, 2022

Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login example with Spring Security, MySQL and JWT Appropriate Flow for User Login and Registration with JWT Spring Boot Rest Api Architect

Jan 5, 2023

100+ Spring Boot Articles, Tutorials, Video tutorials, Projects, Guides, Source code examples etc

YouTube Channel - Spring Boot Tutorial Subscribe for future video and updates Spring Boot Tutorial on YouTube Newly published spring boot tutorials (2

Jan 2, 2023

This repository is related to the Java Web Developer (ND035), Course - Web Services and APIs

About this Repository This repository is related to the Java Web Developer (ND035), Course - Web Services and APIs It contains the following folders:

Jan 28, 2022

This Web Application Allows A user to upload a two minutes Video. It uses Server Side Capabilities of Nodejs and Spring Boot .

This Web Application Allows A user to upload a two minutes Video. It uses Server Side Capabilities of Nodejs and Spring Boot .

VideoStreamingApplication Purpose Of This Application These days trend of short videos are on rise youtube recently realsed "Shorts" . So , taking ins

Nov 13, 2022

Spring Boot web application vulnerable to CVE-2021-44228, nicknamed Log4Shell.

Spring Boot web application vulnerable to CVE-2021-44228, nicknamed Log4Shell.

Log4Shell sample vulnerable application (CVE-2021-44228) This repository contains a Spring Boot web application vulnerable to CVE-2021-44228, nickname

Jan 5, 2023

A web application to generate Java source code with spring-boot and mybatis-plus

A web application to generate Java source code with spring-boot and mybatis-plus

A web application to generate Java source code with spring-boot and mybatis-plus. Also, The class of Domain,Mapper,XML of Mapper Interface,Service,Controller are included. You can change the data source what you want to generate for your project in app running without restart this code -generator application.

Aug 29, 2022

In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc.

In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc.

In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc. They both will fetch 1 million of customer's data from MySQL and stream them to Kafka. The main goal is to compare the application's performance and resource utilization.

Nov 2, 2022
Owner
Denys Vozniuk
Software QA Engineer
Denys Vozniuk
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
about learning Spring Boot via examples. Spring Boot 教程、技术栈示例代码,快速简单上手教程。

Spring Boot 学习示例 Spring Boot 使用的各种示例,以最简单、最实用为标准,此开源项目中的每个示例都以最小依赖,最简单为标准,帮助初学者快速掌握 Spring Boot 各组件的使用。 Spring Boot 中文索引 | Spring Cloud学习示例代码 | Spring

纯洁的微笑 28.3k Jan 1, 2023
Spring Boot JdbcTemplate example with SQL Server: CRUD Rest API using Spring Data JDBC, Spring Web MVC

Spring Boot JdbcTemplate example with SQL Server: Build CRUD Rest API Build a Spring Boot CRUD Rest API example that uses Spring Data Jdbc to make CRU

null 7 Dec 20, 2022
An examples of creating test records in the database with Spring Boot + Spring Data + JPA usage.

Spring Boot + JPA — Clear Tests An examples of creating test records in the database with Spring Boot + Spring Data + JPA usage. Check out the article

Semyon Kirekov 8 Nov 24, 2022
In this course, we will learn how to build a complete full-stack web application using Spring boot as backend and React (React Hooks) as frontend

In this course, we will learn how to build a complete full-stack web application using Spring boot as backend and React (React Hooks) as frontend. We will use MySQL database to store and retrieve the data.

Ramesh Fadatare 43 Dec 22, 2022
The goal of the project is to create a web application using Java EE and database (PostgreSQL) without connecting a modern technology stack like spring boot and hibernate

About The Project SignIn page SignUp page Profile page The goal of the project is to create a web application using Java EE and database (PostgreSQL)

Islam Khabibullin 2 Mar 23, 2022
Spring GraphQL examples using Netflix DGS, GraphQL Java and Spring GraphQL

spring-graphql-sample Spring GraphQL examples using the following frameworks and libraries: Netflix DGS(Domain Graph Service) framework Spring GraphQL

Hantsy Bai 56 Dec 20, 2022
The repository is created to showcase examples of microservices patterns using different technologies.

Repository Objective The goal of this repository is to demonstrate coding examples in different languages mainly Java and .NET core. These examples wi

Roland Salloum 13 Nov 17, 2022
This bare project template includes a minimal setup for using unimodules with React Native tvOS.

What This is a clone of expo's bare minimal template which includes a minimal setup for using unimodules with React Native. Additionally, this templat

Abdullah Musab Ceylan 4 Dec 25, 2022
This repository contains source code examples to support my course Spring Data JPA and Hibernate Beginner to Guru

Spring Data JPA - Spring Data JPA This repository contains source code examples to support my course Spring Data JPA and Hibernate Beginner to Guru Co

John Thompson 8 Aug 24, 2022