1

I am currently using chrome-webdriver with selenium-webdriver in NodeJS.

I instantiate the chrome browser with NodeJS, and use selenium-webdriver asynchronously to interact with it's elements

Currently, as my example: I am trying to click on the canvass on this site

however as noted on this question, selenium does not allow that. there are other posted solutions but are for Java or C#. I have tried looking for the equivalent of the "Actions" library in JAVA or the "ActionChains" in python but failed.

I am trying to do this without Helium, as the challenge is to use open source.

currently I have a hold of the element below (I assume we get a hold of the div instad of the canvass... but I might be mistaken)

element = await driver.findElement(By.id("aww-container")); 

however, I have tried the following with failed solutions

  • .clickAt(x, y) (returns error "clickAt() is not a function")
  • driver.elementFromPoint(x,y) (also returns error "clickAt() is not a function"
  • document.elementFromPoint (fails because I am executing javascript from nodejs.. not from the browser.)

Is there a way for my current setup to click on an element via the x and y coordinates asynchronously with my setup? I do not mind adding another library as long as it is open source.

Malcolm Salvador
  • 1,476
  • 2
  • 21
  • 40
  • did you try `browser.moveToObject(selector,xoffset,yoffset);`? This will move the mouse by an offset of the specified element. If an element is provided but no offset, the mouse will be moved to the center of the element. If the element is not visible, it will be scrolled into view. – GPT14 Jun 05 '18 at 04:12
  • is `.moveToObject` part of the selenium-webdriver module? Like... `let driver = await new webDr.Builder().withCapabilities(webDr.Capabilities.chrome()).build();` then `await driver.moveToObject(selector,xoffset,yoffset);` then `await driver.click()`? – Malcolm Salvador Jun 05 '18 at 14:15
  • http://webdriver.io/api/action/moveToObject.html – GPT14 Jun 05 '18 at 14:45

0 Answers0