Unable to drag drop dynamic content in selenium chromedriver using ActionChains

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unable to drag drop dynamic content in selenium chromedriver using ActionChains

UJustGotLittUp

In the following hierarchy, I am trying to use Action chains to drag drop first draggable element of a list element
to an offset x = -20 and y=0 (that is 20 pixels drag left to its current location)
using the function ActionChains(self.driver).drag_and_drop_by_offset(x,y).perform() 
where self.driver = webdriver.Chrome(chrome_options=options) but nothing happens after the command gets executed without any error


<!-- some hierarchy-->
<div class="result-list expandable-result-list">
   <div draggable="true" class="result selected-row">
      <div class="result-sub-row">
         <!-- multiple divs for individual cells in the row-->
      </div>
      <!---->                        
   </div>
   <div draggable="true" class="result">
      <div class="result-sub-row">
        <!-- multiple divs for individual cells in the row-->
      </div>
      <!---->                                  
   </div>
</div>
<!-- some hierarchy-->


I am using the following code (assume driver = webdriver.Chrome(chrome_options=options)):


list_items_xpath = '//div[@class="result-list expandable-result-list"]//div[@draggable="true"and@class="result"]'
list_items_table = self.selenium2.wait_xpath(list_items_xpath)

element_to_drag = list_elements.find_elements_by_xpath(list_items_table)[0]
ActionChains(driver).drag_and_drop_by_offset(element_to_drag, "-20", "0").perform()


How can I make this work? Am I missing something here?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/135af73b-43f7-46e0-aa98-92f92e7d5150%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.