Double Click Calendar with Selenium NodeJS












1














https://imgur.com/bcKQIJr <-- Calendar Image



I have a calendar that requires a double click select dates. I'm working in Javascript, and the NodeJS Selenium-webdriver library has a pretty limited set of events, with no double click option... Do I need to incorporate another library for a double click feature or something? I've really hit a wall.



I know this code doesn't work, I've tried a little bit of everything. I just need to double click on a list of elements like the one below.



`el = driver.findElement(By.xpath("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]"));

el.click()
.then(_ => driver.sleep(250))
.then(_ => el.click())
`


I can see the clicks happening, so I know I have the element right and the event is happening at the right place/time... but I can't trigger the "selected" dates with what I've got.










share|improve this question






















  • images are not good way to show what exactly you doing, or trying to achieve, always add HTML snip so other can reproduce your problem
    – Dev
    Dec 27 '18 at 22:37
















1














https://imgur.com/bcKQIJr <-- Calendar Image



I have a calendar that requires a double click select dates. I'm working in Javascript, and the NodeJS Selenium-webdriver library has a pretty limited set of events, with no double click option... Do I need to incorporate another library for a double click feature or something? I've really hit a wall.



I know this code doesn't work, I've tried a little bit of everything. I just need to double click on a list of elements like the one below.



`el = driver.findElement(By.xpath("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]"));

el.click()
.then(_ => driver.sleep(250))
.then(_ => el.click())
`


I can see the clicks happening, so I know I have the element right and the event is happening at the right place/time... but I can't trigger the "selected" dates with what I've got.










share|improve this question






















  • images are not good way to show what exactly you doing, or trying to achieve, always add HTML snip so other can reproduce your problem
    – Dev
    Dec 27 '18 at 22:37














1












1








1







https://imgur.com/bcKQIJr <-- Calendar Image



I have a calendar that requires a double click select dates. I'm working in Javascript, and the NodeJS Selenium-webdriver library has a pretty limited set of events, with no double click option... Do I need to incorporate another library for a double click feature or something? I've really hit a wall.



I know this code doesn't work, I've tried a little bit of everything. I just need to double click on a list of elements like the one below.



`el = driver.findElement(By.xpath("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]"));

el.click()
.then(_ => driver.sleep(250))
.then(_ => el.click())
`


I can see the clicks happening, so I know I have the element right and the event is happening at the right place/time... but I can't trigger the "selected" dates with what I've got.










share|improve this question













https://imgur.com/bcKQIJr <-- Calendar Image



I have a calendar that requires a double click select dates. I'm working in Javascript, and the NodeJS Selenium-webdriver library has a pretty limited set of events, with no double click option... Do I need to incorporate another library for a double click feature or something? I've really hit a wall.



I know this code doesn't work, I've tried a little bit of everything. I just need to double click on a list of elements like the one below.



`el = driver.findElement(By.xpath("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]"));

el.click()
.then(_ => driver.sleep(250))
.then(_ => el.click())
`


I can see the clicks happening, so I know I have the element right and the event is happening at the right place/time... but I can't trigger the "selected" dates with what I've got.







javascript node.js selenium






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 27 '18 at 22:12









Dave Kubo

82




82












  • images are not good way to show what exactly you doing, or trying to achieve, always add HTML snip so other can reproduce your problem
    – Dev
    Dec 27 '18 at 22:37


















  • images are not good way to show what exactly you doing, or trying to achieve, always add HTML snip so other can reproduce your problem
    – Dev
    Dec 27 '18 at 22:37
















images are not good way to show what exactly you doing, or trying to achieve, always add HTML snip so other can reproduce your problem
– Dev
Dec 27 '18 at 22:37




images are not good way to show what exactly you doing, or trying to achieve, always add HTML snip so other can reproduce your problem
– Dev
Dec 27 '18 at 22:37












2 Answers
2






active

oldest

votes


















0














In case of some case (specific to browsers) this might not work for calendars. You might need to use javascript executer for this purpose. Below is some code for your reference.



    let ele = document.evaluate("//th[@title='Chrome']", document, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('dblclick', true, true);
ele.dispatchEvent (clickEvent);


This should simulate double click on the element. Store this script in a variable (e.g. scrpit) and send to browser for execution using js executor. below is some sample code assuming variable script has the js script



    driver.executeScript(script).then(function(return_value) {
console.log('returned ', return_value)
});





share|improve this answer





















  • This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
    – Dave Kubo
    Dec 28 '18 at 23:15





















0














You should be able to use the actions() method as described in this question's answer.



driver.actions().doubleClick(el).perform();





share|improve this answer





















  • I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
    – Dave Kubo
    Dec 28 '18 at 1:16











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%2f53951386%2fdouble-click-calendar-with-selenium-nodejs%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














In case of some case (specific to browsers) this might not work for calendars. You might need to use javascript executer for this purpose. Below is some code for your reference.



    let ele = document.evaluate("//th[@title='Chrome']", document, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('dblclick', true, true);
ele.dispatchEvent (clickEvent);


This should simulate double click on the element. Store this script in a variable (e.g. scrpit) and send to browser for execution using js executor. below is some sample code assuming variable script has the js script



    driver.executeScript(script).then(function(return_value) {
console.log('returned ', return_value)
});





share|improve this answer





















  • This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
    – Dave Kubo
    Dec 28 '18 at 23:15


















0














In case of some case (specific to browsers) this might not work for calendars. You might need to use javascript executer for this purpose. Below is some code for your reference.



    let ele = document.evaluate("//th[@title='Chrome']", document, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('dblclick', true, true);
ele.dispatchEvent (clickEvent);


This should simulate double click on the element. Store this script in a variable (e.g. scrpit) and send to browser for execution using js executor. below is some sample code assuming variable script has the js script



    driver.executeScript(script).then(function(return_value) {
console.log('returned ', return_value)
});





share|improve this answer





















  • This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
    – Dave Kubo
    Dec 28 '18 at 23:15
















0












0








0






In case of some case (specific to browsers) this might not work for calendars. You might need to use javascript executer for this purpose. Below is some code for your reference.



    let ele = document.evaluate("//th[@title='Chrome']", document, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('dblclick', true, true);
ele.dispatchEvent (clickEvent);


This should simulate double click on the element. Store this script in a variable (e.g. scrpit) and send to browser for execution using js executor. below is some sample code assuming variable script has the js script



    driver.executeScript(script).then(function(return_value) {
console.log('returned ', return_value)
});





share|improve this answer












In case of some case (specific to browsers) this might not work for calendars. You might need to use javascript executer for this purpose. Below is some code for your reference.



    let ele = document.evaluate("//th[@title='Chrome']", document, null,XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('dblclick', true, true);
ele.dispatchEvent (clickEvent);


This should simulate double click on the element. Store this script in a variable (e.g. scrpit) and send to browser for execution using js executor. below is some sample code assuming variable script has the js script



    driver.executeScript(script).then(function(return_value) {
console.log('returned ', return_value)
});






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 28 '18 at 22:40









neeraj jain

513




513












  • This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
    – Dave Kubo
    Dec 28 '18 at 23:15




















  • This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
    – Dave Kubo
    Dec 28 '18 at 23:15


















This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
– Dave Kubo
Dec 28 '18 at 23:15






This was the magic. Here's my working code var el = 'let ele=document.evaluate("//div[@class='container']//table[2]//tbody[1]//tr[1]//td[3]",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;var clickEvent=document.createEvent("MouseEvents");clickEvent.initEvent("dblclick",!0,!0),ele.dispatchEvent(clickEvent); driver.executeScript(el).then(function(return_value) { console.log('returned ', return_value) })
– Dave Kubo
Dec 28 '18 at 23:15















0














You should be able to use the actions() method as described in this question's answer.



driver.actions().doubleClick(el).perform();





share|improve this answer





















  • I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
    – Dave Kubo
    Dec 28 '18 at 1:16
















0














You should be able to use the actions() method as described in this question's answer.



driver.actions().doubleClick(el).perform();





share|improve this answer





















  • I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
    – Dave Kubo
    Dec 28 '18 at 1:16














0












0








0






You should be able to use the actions() method as described in this question's answer.



driver.actions().doubleClick(el).perform();





share|improve this answer












You should be able to use the actions() method as described in this question's answer.



driver.actions().doubleClick(el).perform();






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 27 '18 at 22:33









MPawlak

44029




44029












  • I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
    – Dave Kubo
    Dec 28 '18 at 1:16


















  • I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
    – Dave Kubo
    Dec 28 '18 at 1:16
















I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
– Dave Kubo
Dec 28 '18 at 1:16




I did try that, but I get this error right at that line: UnknownCommandError: POST /session/3c399601-a7fb-4867-8903-bf01c13e420c/moveto did not match a known command at Object.throwDecodedError (C:UsersdavekDesktopProjectsSelenium_testnode_modulesselenium-webdriverliberror.js:514:15)
– Dave Kubo
Dec 28 '18 at 1:16


















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53951386%2fdouble-click-calendar-with-selenium-nodejs%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

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas