During DragAndDropToObject in Selenium IDE, the initial element in the list is overlooked

I have a webpage that is split into two datagrids. The left datagrid is structured like this:

<ul class="left_dg">
    <li>
        <ul></ul>
    </li>
    <li>
        <ul></ul>
    </li>
    <li>
        <ul></ul>
    </li>
    ...
</ul>

The right datagrid, on the other hand, follows a simple 'ul-li' structure with a class called "right_dg". I am using dragAndDropToObject to move li-elements from the right datagrid to the left one. Here is an example of how it works:

<tr>
    <td>dragAndDropToObject</td>
    <td>css=.right_dg > li:nth-child(2)</td>
    <td>css=.left_dg > li:nth-child(1) > ul</td>
</tr>
<tr>
    <td>dragAndDropToObject</td>
    <td>css=.right_dg > li:nth-child(2)</td>
    <td>css=.left_dg > li:nth-child(2) > ul</td>
</tr>
<tr>
    <td>dragAndDropToObject</td>
    <td>css=.right_dg > li:nth-child(2)</td>
    <td>css=.left_dg > li:nth-child(3) > ul</td>
</tr>

However, there seems to be an issue where

<td>css=.left_dg > li:nth-child(1) > ul</td>
selects a child of the second li-element instead of the first one.

Does anyone know how I can target a child of the first li-element instead? Your help is greatly appreciated as I am new to Selenium and still learning. Thank you.

Answer №1

Not sure why this issue occurs, but you can try the code below to target the first element:

<tr>
     <td>mouseDownAt</td>
     <td>css=.right_dg > li:nth-child(2)</td>
     <td></td>
</tr>
<tr>
      <td>mouseMoveAt</td>
      <td>css=.left_dg > li:nth-child(1) > ul</td>
      <td></td>
</tr>
<tr>
      <td>mouseUpAt</td>
       <td>css=.left_dg > li:nth-child(1) > ul</td>
       <td></td>
</tr>

To interact with second, third, and subsequent elements, you can continue using dragAndDropToObject. This method should work effectively.

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

Ways to retrieve the page name where the script originates from

I have a function that is triggered from three different pages. Each page involves adding an attribute to a specific div. For instance: <div id="posts" page="home"></div> <div id="posts" page="feed"></div> <div id="posts" page= ...

html scroll to the flickering page

Why is it that when a user clicks on a link in the list, the browser flickers? This issue becomes especially noticeable if a user clicks on the same 'link' twice. Is there a solution to prevent this from occurring? The problem also seems to aris ...

What steps should I take to effectively configure the header cache on my website?

After navigating through various links and attempting different solutions such as adding <meta HTTP-EQUIV="EXPIRES" CONTENT="Thu, 31 Dec 2015 12:00:00 GMT"> to my header without success, I am struggling to find a comprehensive guide on how and wher ...

Having trouble locating the right input field using the Xpath/ID in Selenium webdriver

I have been struggling to pinpoint the correct xpath for the HTML code provided. After many attempts and 3 days of effort, I am throwing in the towel and seeking assistance. When checking from IDE after recording (execute code), it correctly identifies the ...

Is there a way to display the month values in my dropdown menu using the date format of yyyy-mm-dd?

This is the code snippet I am working with: <form> <table> <tr> <td>Month</td> <td> <select name=""> <option value="">January</optio ...

Performing a click event in Selenium without triggering the opening of a new tab

I have developed a bot that is capable of opening new tabs and interacting with multiple tabs simultaneously. Here is the code snippet I am using to open a new tab: driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"t"); This works perfe ...

JQuery addClass function not functioning properly when used in conjunction with an AJAX request

I have a website where I've implemented an AJAX pagination system. Additionally, I've included a JQUERY call to add a class to certain list items within my document ready function. $(document).ready(function(){ $(".products ul li:nth-child(3 ...

"Chrome seems to be having trouble with the alert function, but Firefox has no issue with

When I use the code with Firefox driver, it works perfectly. However, when I switch to Chrome driver, the code doesn't seem to function as expected. driver.get("https://the-internet.herokuapp.com"); Thread.sleep(2000); driver.findElement(By.xpath("// ...

Struggling to locate a straightforward sidebar solution without relying on Bootstrap. Finding an easy-to-use answer seems

I have a lightweight and easy-to-understand code for a website project with two panels. The first panel on the left is a large navigation (270px width, top to bottom, similar to a wiki) with approximately 30 unordered list items. Next to it is the second ...

Incorporate a horizontally rotating preloader to enhance loading experience

I am currently in the process of developing a preloader that rotates an image horizontally. After researching different threads and ideas, I came across a solution that looks something like this: <style> .imageRotateHorizontal{ -moz-anima ...

The data sent to the controller through AJAX is empty

I am facing an issue while trying to return a List of objects back to my controller. The problem is that the list appears as null when it reaches the controller. Below is the structure of what I am doing: Controller Action Signature [HttpGet] public Acti ...

Utilizing cookies to track the read status of articles - markers for reference

Currently, I am in the process of developing a website and am interested in implementing a feature that allows users to track which articles they have read. I am considering adding a small circle next to each article heading to signify whether it has been ...

Does anyone know if there is a way to use JavaScript to implement LESS in CSS files

Is there a way to perform variable substitution, especially in CSS using JavaScript? I am looking for a solution that offers more features than just variable substitution, such as the LESS syntax. Has anyone come across a JavaScript implementation of LES ...

The Jquery AJAX function encounters a 403 Forbidden error while making a web service call

I encountered an issue with a web page that includes an AJAX method. Here is the code snippet: $(document).ready(function() { $.ajax({ type: "POST", url: "http://www.webservice.com/blahblah.asmx/blahb123", ...

Encountered a Three.js error labeled as Uncaught TypeError while trying to follow

I've been following a tutorial on how to integrate three.js into my project from this video: https://www.youtube.com/watch?v=1TeMXIWRrqE I copied the source code provided at the bottom of this webpage: After downloading and extracting the model into ...

Steps for transferring a checked statement from an HTML document to a JavaScript file

Struggling to transfer checked statements from HTML to JS file {{#each readValues }} <br> Plug: {{@index}} => {{this}} <input type='checkbox' class="plug" onclick="sendData();" /> {{/each}} The code above is written i ...

What is the best way to incorporate the :after pseudo-element in JavaScript code

HTML: This is my current code snippet <div class="one"> Apple </div> I am looking to dynamically add the word "juice" using JavaScript with the .style property. Is there an equivalent of :: after in CSS, where I can set the content in JavaS ...

NextJS compilation sometimes results in undefined errors when using Sass styles

My peace lies in the sass code: .link display: inline-table text-align: center align-self: center margin: 5px 15px font-size: 20px color: black text-decoration: none transition: 0.1s ease-in-out .link:hover text-decoration: underline .l ...

Getting caught in a loop with JQuery toggle() after clicking on two different buttons

One of the features I am working on involves a menu bar that needs to be hidden and shown when the register button and login button are clicked. Here is my HTML structure: <div class="top"> <ul> <li><a id="login" href="#"> ...

Switch the contenteditable HTML attribute in a dynamically generated table using PHP

Despite finding numerous articles and solutions, my code still refuses to work. What could I be overlooking? Below is a snippet of the code where the crucial part is marked at the comment '! HERE') <!-- Table with grades --> <table clas ...