Tips for effortlessly moving rows between Grid views using drag and drop functionality

driver.findElement(By.xpath(".//*[@id='tbplayers']/tbody/tr[2]/td[3]")).click();   
WebElement dragme = driver.findElement(By.xpath(".//*[@id='tbplayers']/tbody/tr[2]/td[3]"));
WebElement drop = driver.findElement(By.xpath(".//*[@id='tbField']/tbody/tr/td"));
Actions action =new Actions(driver);
Action dragAndDrop = action.clickAndHold(dragme).moveToElement(drop).release(drop).build();
dragAndDrop.perform();

During the test script execution, I encountered an issue where the row values could not be dropped and no error message was displayed.

Answer №1

One important thing to note is that you do not necessarily need to utilize both the Action and Actions classes simultaneously. The Actions class is a component of selenium and it is recommended to make use of it:

Actions actions =new Actions(driver);
actions.clickAndHold(dragme).moveToElement(drop).release(drop).build().perform();

This approach should function properly.

Alternatively, you can opt for the built-in method:

Actions actions =new Actions(driver);
actions.dragAndDrop(dragme, drop).build().perform();

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Clustering JSON documents with the power of Machine Learning

Looking to conduct document clustering using JSON String data containing various key-value pairs of String and Number types. The goal is to cluster documents based on similar types of keys and values. For example, consider the following JSON Document: {" ...

Could the sluggishness of Selenium Python with Chrome be attributed to cookies causing issues?

After researching, I discovered that Selenium Chrome may perform better if certain optimizations are applied such as implicit waits, headless mode, usage of ID and CSS selectors, etc. However, before making these adjustments, I am concerned about whether c ...

How to Set Cookies in Selenium Without Actually Navigating to a Page

I need help setting cookies for a domain that I have not visited using a Selenium plugin for Gecko Driver. My goal is to set a cookie to bypass a login page, but the domain keeps redirecting, making it impossible to set the cookie by visiting it directly. ...

When using the method find_element_by_css_selector('a').get_attribute('href'), a NoSuchElementException is returned if the element cannot be found

I have been attempting to scrape product links from a specific website using my program. The process involves opening the necessary URL in the browser and extracting all the links with a particular class name. However, I keep encountering a NoSuchElementEx ...

Seeking out an element that includes @nbsp; in the text - what's the best method

There's a piece of html code with an element - <h3>App-1 Playground&nbsp;Login</h3> I am trying to identify this element using the entire text - App-1 Playground Login, but the presence of &nbsp; is causing issues. I need help i ...

Differences between save_screenshot() and get_screenshot_as_file() methods in Selenium using Python

Two screenshots of Django Admin were captured using the functions save_screenshot() and get_screenshot_as_file(), as demonstrated below. I am utilizing Django, pytest-django, and Selenium: save_screenshot(): from selenium import webdriver def test_1(live ...

StaleElementReferenceException: the element no longer exists in the page document and is considered stale

Encountering an issue with my selenium java project where I keep receiving an error message. for(WebElement link:AllTheLinkList) { if (link.getAttribute("href") != null && ! link.getAttribute("href").contentEquals("javascript")) { ...

Having trouble interacting with a button while using Chrome under webdriver control

I have been using a combination of VBA and Selenium to automate tasks in my office. Currently, I am working on a script that will open Chrome at a Dell support page, input serial numbers (SN) from an Excel spreadsheet to check warranty information, and the ...

Updating webdriver-manager can sometimes result in a "spawn Unknown system error -86" message. This error

(Angular). webdriver-manager 12.1.7 is causing issues specifically on Intel-based Macs. When running e2e tests, the error message "spawn Unknown system error -86" is encountered. The bug has been addressed in webdriver-manager 12.1.8, however, I am facing ...

Utilize the Jackson library in Java to import a JSON URL and parse its contents

I am currently attempting to read and parse a JSON link using Java in order to utilize it for various purposes. However, I am encountering errors that are leaving me uncertain on how to proceed. Below is the snippet of code I am working with: package weat ...

When utilizing Selenium with Python, the find_element method effectively locates the initial element based on xpath. However, the find_elements method unexpectedly returns an empty set,

I am completely new to using Selenium, so please forgive me if I have overlooked any important steps. Here is the code snippet that I am currently working with: At this stage, the program has successfully navigated to a user's Twitter profile and nee ...

Learn the process of establishing a connection to a remote MongoDB server from an Angular-Spring application running on a separate server

My MongoDB is currently hosted on X box, while the Angular-Spring Application is hosted on Y box. When both are running locally, my application functions properly; however, upon configuring them at the server level, I encountered the following issue: HTTP ...

Moshi was anticipating an object to start but instead encountered an array at the beginning - custom converter was

My current setup involves using Moshi for converting Retrofit responses into objects. However, I've encountered a specific issue where the conversion fails and an exception is thrown: com.squareup.moshi.JsonDataException: Expected BEGIN_OBJECT but was ...

Contrasting the uses of element(...) versus element(...).getWebElement() in Protractor

What is the advantage of using element(...).getWebElement() instead of element(...) when they both perform similarly? Why are there two different APIs for the same purpose? ...

In the event that I have both Chrome (32 bit) and Chrome Canary installed on my system, how can ChromeDriver distinguish between the two?

I recently ran into an issue with WebDriver and my Chrome installations. Even though I have both the 32-bit version and Chrome Canary installed, WebDriver always defaults to opening the 32-bit version due to the path provided. When attempting to specify t ...

Uh oh, JMeterThread encountered an issue: Test failed due to org.openqa.selenium.WebDriverException - driver server took too long to start

My current setup involves using chromedriverVersion: 83.0.4103.39 and Chrome version =83.0.4103.97 for efficient execution on Jmeter. However, after a few hours of testing, I encounter an error message stating "ERROR o.a.j.t.JMeterThread: Test failed! or ...

Discover how to utilize Firebug in Java to access a node's CSS properties

Is there a way to access all properties (CSS, etc) of web page nodes using Firebug within Java code without relying on XPath? I would like to retrieve all available properties instead of checking for them individually. Any advice on how to achieve this? ...

Python Selenium Error: session ID is not valid

After attempting to initiate the web driver, randomly putting it to sleep, and then closing it, I encountered an error with the message "invalid session id." Can anyone offer a solution to this issue? Please The code snippet in question is as follows: ...

Error in Selenium: Element's click action was intercepted

I've run into an issue while using find_element_by_xpath() to click on an element. Despite my previous experience with Selenium, the element in question is generating an error when attempted to be clicked. I'm relatively new to Selenium and have ...

Creating automation applications for the Android operating system involves a series of steps that

Is there a way to create an app that can automate tasks such as liking every post in my Instagram feed? What additional skills would I need to learn besides using Android Studio? ...