Selenium Webdriver move mouse to Point

后端 未结 8 1044
小鲜肉
小鲜肉 2020-12-05 11:24

I am currently trying to move the cursor to a point (org.openqa.selenium.Point) that has been set by checking for an occurrence of a marker on a live chart from

相关标签:
8条回答
  • 2020-12-05 12:00

    Got it working with

    Actions builder = new Actions(driver);
    WebElement el = some element;
    builder.keyDown(Keys.CONTROL)
    .moveByOffset( 10, 25 )
    .clickAndHold(el)
    .build().perform();
    
    0 讨论(0)
  • 2020-12-05 12:02

    Why use java.awt.Robot when org.openqa.selenium.interactions.Actions.class would probably work fine? Just sayin.

    Actions builder = new Actions(driver);
    
    builder.keyDown(Keys.CONTROL)
       .click(someElement)
       .moveByOffset( 10, 25 );
       .click(someOtherElement)
       .keyUp(Keys.CONTROL).build().perform();
    
    0 讨论(0)
提交回复
热议问题