Selenium::WebDriver::Error - Drag and drop action using WATIR





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















We are trying to simulate a drag and drop action using WATIR, however, we seem to be getting some strange errors in return.



First, we store the 'drag item' and its destination:



drag = @browser.trs(:draggable => 'true')
drop = drag[0]
destination = drag[1]


The first test we ran combined mouse events:



drop.fire_event("onmousedown")
@browser.driver.action.click_and_hold(drop).perform
@browser.driver.action.move_to(destination).click.perform
drop.fire_event("onmouseup")


The second test we ran used the drag and drop method:
@browser.driver.action.drag_and_drop_by(drop, 0, 500).perform



However, both attempts result in the same error:



Selenium::WebDriver::Error::InvalidArgumentError: data did not match any variant of untagged enum PointerActionItem at line 1 column 225
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/step_definitions/W1.1.4-Reorder_Shotlist.rb:10:in `/^SA drag the selected shotlist to reorder$/'
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/W1.1.4-Reorder_Shotlist.feature:9:in `When SA drag the selected shotlist to reorder'


We think that this error refers to the @browser.driver.action. reference in both methods, but are unsure how to resolve this.



Any advice would be most welcome!





Edit 26/11/2018



As per suggestions below, we tried the drag_and_drop_on method using the following code:



draggable = @browser.trs(:draggable => 'true')
target = draggable[0]
destination = draggable[1]
target.drag_and_drop_on destination
sleep(5)


While this produced no errors, it also didn't seem to produce any results (i.e. moving the target element to the position of the destination element).










share|improve this question




















  • 1





    You might want to double-check you're passing the right arguments. From the examples, your drop might be a String (ie the drop = drop.text) or a Watir::Element. The Selenium methods will expect a Selenium::WebDriver::Element. Using @titusfortner's answer will simplify a lot since you can stick with Watir::Element.

    – Justin Ko
    Nov 22 '18 at 1:24











  • @JustinKo sorry, that was just a typo from formatting the code for this question (has been fixed above)

    – Ryan Achten
    Nov 26 '18 at 0:07


















0















We are trying to simulate a drag and drop action using WATIR, however, we seem to be getting some strange errors in return.



First, we store the 'drag item' and its destination:



drag = @browser.trs(:draggable => 'true')
drop = drag[0]
destination = drag[1]


The first test we ran combined mouse events:



drop.fire_event("onmousedown")
@browser.driver.action.click_and_hold(drop).perform
@browser.driver.action.move_to(destination).click.perform
drop.fire_event("onmouseup")


The second test we ran used the drag and drop method:
@browser.driver.action.drag_and_drop_by(drop, 0, 500).perform



However, both attempts result in the same error:



Selenium::WebDriver::Error::InvalidArgumentError: data did not match any variant of untagged enum PointerActionItem at line 1 column 225
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/step_definitions/W1.1.4-Reorder_Shotlist.rb:10:in `/^SA drag the selected shotlist to reorder$/'
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/W1.1.4-Reorder_Shotlist.feature:9:in `When SA drag the selected shotlist to reorder'


We think that this error refers to the @browser.driver.action. reference in both methods, but are unsure how to resolve this.



Any advice would be most welcome!





Edit 26/11/2018



As per suggestions below, we tried the drag_and_drop_on method using the following code:



draggable = @browser.trs(:draggable => 'true')
target = draggable[0]
destination = draggable[1]
target.drag_and_drop_on destination
sleep(5)


While this produced no errors, it also didn't seem to produce any results (i.e. moving the target element to the position of the destination element).










share|improve this question




















  • 1





    You might want to double-check you're passing the right arguments. From the examples, your drop might be a String (ie the drop = drop.text) or a Watir::Element. The Selenium methods will expect a Selenium::WebDriver::Element. Using @titusfortner's answer will simplify a lot since you can stick with Watir::Element.

    – Justin Ko
    Nov 22 '18 at 1:24











  • @JustinKo sorry, that was just a typo from formatting the code for this question (has been fixed above)

    – Ryan Achten
    Nov 26 '18 at 0:07














0












0








0








We are trying to simulate a drag and drop action using WATIR, however, we seem to be getting some strange errors in return.



First, we store the 'drag item' and its destination:



drag = @browser.trs(:draggable => 'true')
drop = drag[0]
destination = drag[1]


The first test we ran combined mouse events:



drop.fire_event("onmousedown")
@browser.driver.action.click_and_hold(drop).perform
@browser.driver.action.move_to(destination).click.perform
drop.fire_event("onmouseup")


The second test we ran used the drag and drop method:
@browser.driver.action.drag_and_drop_by(drop, 0, 500).perform



However, both attempts result in the same error:



Selenium::WebDriver::Error::InvalidArgumentError: data did not match any variant of untagged enum PointerActionItem at line 1 column 225
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/step_definitions/W1.1.4-Reorder_Shotlist.rb:10:in `/^SA drag the selected shotlist to reorder$/'
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/W1.1.4-Reorder_Shotlist.feature:9:in `When SA drag the selected shotlist to reorder'


We think that this error refers to the @browser.driver.action. reference in both methods, but are unsure how to resolve this.



Any advice would be most welcome!





Edit 26/11/2018



As per suggestions below, we tried the drag_and_drop_on method using the following code:



draggable = @browser.trs(:draggable => 'true')
target = draggable[0]
destination = draggable[1]
target.drag_and_drop_on destination
sleep(5)


While this produced no errors, it also didn't seem to produce any results (i.e. moving the target element to the position of the destination element).










share|improve this question
















We are trying to simulate a drag and drop action using WATIR, however, we seem to be getting some strange errors in return.



First, we store the 'drag item' and its destination:



drag = @browser.trs(:draggable => 'true')
drop = drag[0]
destination = drag[1]


The first test we ran combined mouse events:



drop.fire_event("onmousedown")
@browser.driver.action.click_and_hold(drop).perform
@browser.driver.action.move_to(destination).click.perform
drop.fire_event("onmouseup")


The second test we ran used the drag and drop method:
@browser.driver.action.drag_and_drop_by(drop, 0, 500).perform



However, both attempts result in the same error:



Selenium::WebDriver::Error::InvalidArgumentError: data did not match any variant of untagged enum PointerActionItem at line 1 column 225
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/step_definitions/W1.1.4-Reorder_Shotlist.rb:10:in `/^SA drag the selected shotlist to reorder$/'
./features/W1-Administering_a_Shotlist/W1.1-Shotlists/W1.1.4-Reorder_Shotlist.feature:9:in `When SA drag the selected shotlist to reorder'


We think that this error refers to the @browser.driver.action. reference in both methods, but are unsure how to resolve this.



Any advice would be most welcome!





Edit 26/11/2018



As per suggestions below, we tried the drag_and_drop_on method using the following code:



draggable = @browser.trs(:draggable => 'true')
target = draggable[0]
destination = draggable[1]
target.drag_and_drop_on destination
sleep(5)


While this produced no errors, it also didn't seem to produce any results (i.e. moving the target element to the position of the destination element).







firefox selenium-webdriver drag-and-drop automated-tests watir






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 0:13







Ryan Achten

















asked Nov 22 '18 at 0:35









Ryan AchtenRyan Achten

181212




181212








  • 1





    You might want to double-check you're passing the right arguments. From the examples, your drop might be a String (ie the drop = drop.text) or a Watir::Element. The Selenium methods will expect a Selenium::WebDriver::Element. Using @titusfortner's answer will simplify a lot since you can stick with Watir::Element.

    – Justin Ko
    Nov 22 '18 at 1:24











  • @JustinKo sorry, that was just a typo from formatting the code for this question (has been fixed above)

    – Ryan Achten
    Nov 26 '18 at 0:07














  • 1





    You might want to double-check you're passing the right arguments. From the examples, your drop might be a String (ie the drop = drop.text) or a Watir::Element. The Selenium methods will expect a Selenium::WebDriver::Element. Using @titusfortner's answer will simplify a lot since you can stick with Watir::Element.

    – Justin Ko
    Nov 22 '18 at 1:24











  • @JustinKo sorry, that was just a typo from formatting the code for this question (has been fixed above)

    – Ryan Achten
    Nov 26 '18 at 0:07








1




1





You might want to double-check you're passing the right arguments. From the examples, your drop might be a String (ie the drop = drop.text) or a Watir::Element. The Selenium methods will expect a Selenium::WebDriver::Element. Using @titusfortner's answer will simplify a lot since you can stick with Watir::Element.

– Justin Ko
Nov 22 '18 at 1:24





You might want to double-check you're passing the right arguments. From the examples, your drop might be a String (ie the drop = drop.text) or a Watir::Element. The Selenium methods will expect a Selenium::WebDriver::Element. Using @titusfortner's answer will simplify a lot since you can stick with Watir::Element.

– Justin Ko
Nov 22 '18 at 1:24













@JustinKo sorry, that was just a typo from formatting the code for this question (has been fixed above)

– Ryan Achten
Nov 26 '18 at 0:07





@JustinKo sorry, that was just a typo from formatting the code for this question (has been fixed above)

– Ryan Achten
Nov 26 '18 at 0:07












1 Answer
1






active

oldest

votes


















1














The error is caused by a bug in geckodriver 0.22 https://github.com/mozilla/geckodriver/issues/1375



Try downgrading geckodriver and see if it works.



Watir has a direct method:



draggable.drag_and_drop_on droppable





share|improve this answer


























  • thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

    – Ryan Achten
    Nov 26 '18 at 0:14











  • If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

    – titusfortner
    Nov 26 '18 at 23:03











  • for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

    – Ryan Achten
    Nov 27 '18 at 20:55











  • Does it work with chrome?

    – titusfortner
    Nov 28 '18 at 3:31











  • the same (lack of results) also occurs when running the tests on Chrome.

    – Ryan Achten
    Nov 28 '18 at 20:39












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422357%2fseleniumwebdrivererror-drag-and-drop-action-using-watir%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The error is caused by a bug in geckodriver 0.22 https://github.com/mozilla/geckodriver/issues/1375



Try downgrading geckodriver and see if it works.



Watir has a direct method:



draggable.drag_and_drop_on droppable





share|improve this answer


























  • thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

    – Ryan Achten
    Nov 26 '18 at 0:14











  • If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

    – titusfortner
    Nov 26 '18 at 23:03











  • for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

    – Ryan Achten
    Nov 27 '18 at 20:55











  • Does it work with chrome?

    – titusfortner
    Nov 28 '18 at 3:31











  • the same (lack of results) also occurs when running the tests on Chrome.

    – Ryan Achten
    Nov 28 '18 at 20:39
















1














The error is caused by a bug in geckodriver 0.22 https://github.com/mozilla/geckodriver/issues/1375



Try downgrading geckodriver and see if it works.



Watir has a direct method:



draggable.drag_and_drop_on droppable





share|improve this answer


























  • thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

    – Ryan Achten
    Nov 26 '18 at 0:14











  • If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

    – titusfortner
    Nov 26 '18 at 23:03











  • for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

    – Ryan Achten
    Nov 27 '18 at 20:55











  • Does it work with chrome?

    – titusfortner
    Nov 28 '18 at 3:31











  • the same (lack of results) also occurs when running the tests on Chrome.

    – Ryan Achten
    Nov 28 '18 at 20:39














1












1








1







The error is caused by a bug in geckodriver 0.22 https://github.com/mozilla/geckodriver/issues/1375



Try downgrading geckodriver and see if it works.



Watir has a direct method:



draggable.drag_and_drop_on droppable





share|improve this answer















The error is caused by a bug in geckodriver 0.22 https://github.com/mozilla/geckodriver/issues/1375



Try downgrading geckodriver and see if it works.



Watir has a direct method:



draggable.drag_and_drop_on droppable






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 26 '18 at 23:02

























answered Nov 22 '18 at 0:52









titusfortnertitusfortner

3,061718




3,061718













  • thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

    – Ryan Achten
    Nov 26 '18 at 0:14











  • If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

    – titusfortner
    Nov 26 '18 at 23:03











  • for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

    – Ryan Achten
    Nov 27 '18 at 20:55











  • Does it work with chrome?

    – titusfortner
    Nov 28 '18 at 3:31











  • the same (lack of results) also occurs when running the tests on Chrome.

    – Ryan Achten
    Nov 28 '18 at 20:39



















  • thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

    – Ryan Achten
    Nov 26 '18 at 0:14











  • If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

    – titusfortner
    Nov 26 '18 at 23:03











  • for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

    – Ryan Achten
    Nov 27 '18 at 20:55











  • Does it work with chrome?

    – titusfortner
    Nov 28 '18 at 3:31











  • the same (lack of results) also occurs when running the tests on Chrome.

    – Ryan Achten
    Nov 28 '18 at 20:39

















thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

– Ryan Achten
Nov 26 '18 at 0:14





thanks for your response - we actually tried the drag_and_drop_on method a while back - doesn't seem to produce any errors nor any results (I have edited the question to include this example). Any thoughts on why this might be the case?

– Ryan Achten
Nov 26 '18 at 0:14













If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

– titusfortner
Nov 26 '18 at 23:03





If you get something working without the watir method and the watir method does not work, can you let me know? The Watir approach should be doing the Selenium calls that you need without having to deal with action class at all.

– titusfortner
Nov 26 '18 at 23:03













for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

– Ryan Achten
Nov 27 '18 at 20:55





for the most recent test (added to the question above) we used the exact same code you mention in your answer (w/o reference the action class): target.drag_and_drop_on destination. Unfortunately, this doesn't seem to work for us - it doesn't complete the drag and drop action, nor does it provoke any errors.

– Ryan Achten
Nov 27 '18 at 20:55













Does it work with chrome?

– titusfortner
Nov 28 '18 at 3:31





Does it work with chrome?

– titusfortner
Nov 28 '18 at 3:31













the same (lack of results) also occurs when running the tests on Chrome.

– Ryan Achten
Nov 28 '18 at 20:39





the same (lack of results) also occurs when running the tests on Chrome.

– Ryan Achten
Nov 28 '18 at 20:39




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53422357%2fseleniumwebdrivererror-drag-and-drop-action-using-watir%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)