Estoy usando la automatización de prueba Java de Selenium/Selenide y necesito resaltar la palabra ' Entorno '. Esto debe hacerse usando el evento del mouse, ya sea haciendo doble clic en eso o moviendo el mouse.
Una vez hecho esto, debería poder ver otra ventana.
Actualmente, probé varias formas de hacerlo y no tuve éxito. Buscando ayuda en eso.
Este es el elemento de muestra que estoy probando <h2>Local Environment Setup</h2>
Así es como se ubican los elementos 
Estas son las formas en que lo intenté
//Try 1 double click using selenide $(content).doubleClick(); //Try 2 double click using js ((JavascriptExecutor) getWebDriver()).executeScript("arguments[0].dblclick;",content); //Try 3 using x and y (This returns error saying MoveTargetOutOfBoundsException) String jsDoubleClick = "var target = arguments[0]; " + "var offsetX = arguments[1]; " + "var offsetY = arguments[2]; " + "var rect = target.getBoundingClientRect(); " + "var cx = rect.left + (offsetX || (rect.width / 2)); " + "var cy = rect.top + (offsetY || (rect.height / 2)); " + " " + "emit('mousedown', {clientX: cx, clientY: cy, buttons: 1}); " + "emit('mouseup', {clientX: cx, clientY: cy}); " + "emit('mousedown', {clientX: cx, clientY: cy, buttons: 1}); " + "emit('mouseup', {clientX: cx, clientY: cy}); " + "emit('click', {clientX: cx, clientY: cy, detail: 2}); " + " " + "function emit(name, init) { " + "target.dispatchEvent(new MouseEvent(name, init)); " + "} "; ((JavascriptExecutor)getWebDriver()).executeScript(jsDoubleClick, content, content.getLocation().x, content.getLocation().y);Mueva el mouse al elemento por coordenadas desde su centro y haga doble clic con Actions :
//locate the element somehow WebElement h2 = driver.findElement(By.xpath("//h2")); // try to move to the _Environment_ world center, you have to find the x value // 0 - is element center (for Selenium 4 W3C) int x = -100; // -100 worked for this site new Actions(driver).moveToElement(h2, x, 0).doubleClick().build().perform(); Esto funcionó para mí (acabo de encontrar un sitio similar): 