I am trying use the following function

element_ = WebDriverWait(, timeout).until(
        expected_condition((by.XPATH, '//div[@custom_tag="some_value1_&^%^&"]//div[@draggable="true"and @class="some_value2_&^%^&"]'))

element_ = WebDriverWait(driver, timeout).until(
        expected_condition((by.XPATH, '//div[@custom_tag="some_value3_&^%^&"]//div[@class="some_value4_&^%^&"]'))

 wait_drag_to_xpath(driver, element_drag, element_)

def wait_drag_to_xpath(driver, element, tgt_element):

    action = (driver)

    location = tgt_element.location
    action.move_by_offset(location['x'], location['y']).perform()

This is not working, its passing through the code without any actual ui effect or exception and moves to the next break point.

Alternatively, drag_drop_by_offset isn’t working either:

action = ActionChains(driver)
element_drag = WebDriverWait(driver, timeout).until(
        expected_condition((by.XPATH, '//div[@custom_tag="some_value1_&^%^&"]//div[@draggable="true"and @class="some_value2_&^%^&"]'))
location = element_drag.location

#problem piece of code
action.drag_drop_by_offset(element_drag, location['x'],'100') # to drag 100 pixels below and drop out of current GUI div frame element

But the piece of code gives me StaleElementReferenceException: stale element reference: element is not attached to the page document

Kindly provide some solution or insight into how to fix this.

Source link https://sqa.stackexchange.com/questions/34303/-to-drag-drop---in---driver-using-actionchains


Please enter your comment!
Please enter your name here