click Function does not correspond to top-left corner of the element
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, php
- Área
- testing-qa
Línea de trabajo
Empieza reproduciendo clickWithLeftButton y moveMouseOver con la configuración proporcionada de Firefox, Selenium y geckodriver, comparando el comportamiento del offset con Chrome. Usa como referencia las mediciones de offset de JavaScript proporcionadas; se considera terminado cuando el offset solicitado selecciona la esquina prevista del elemento en las pruebas de aceptación de Firefox.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What are you trying to achieve?
We are trying to click an element in a webpage.
What do you get instead?
Wrong element (the left or the right element) gets clicked instead. Based on the documentation here clickWithLeftButton with offset should place the cursor on the upper left corner of the element, but with extensive testing, we've found out that the position of the cursor is actually at the center of the element. Note that we are writing acceptance tests for a web application. The same code works fine with Chrome (configuration below) but it does not work well with Selenium/Gecko/Firefox. We are using an RTL language (Persian) in UTF-8.
Part of the code that is failing :
$I->moveMouseOver($class,10,10);
$I->wait(1);
$I->clickWithLeftButton($class,10,10);
Details
Codeception : 4
PHP : 7.2 Remi
Selenium : 3.8.1 with enablePassThrough function
Geckodriver : 0.26.0
Mozilla Firefox : 72.0.1
OS : Windows 10
acceptance.suite.yml:
# Codeception Test Suite Configuration
#
# Suite for acceptance tests.
# Perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
actor: AcceptanceTester
modules:
enabled:
- \Helper\Acceptance
- WebDriver
- Db
- Asserts
depends:
- Db:
- WebDriver:
- Asserts:
url: 'http://localhost/'
config:
WebDriver:
url: 'http://localhost/'
port: 4444
Db:
dsn: 'mysql:host=1.1.1.1;dbname=mysql;charset=utf8'
user: 'root'
password: 'password'
populate: false
cleanup: false
reconnect: true
env:
firefox:
modules:
config:
WebDriver:
url: 'http://localhost/'
window_size: 1920*1080
browser: firefox
capabilities:
acceptInsecureCerts: true
unexpectedAlertBehaviour: 'accept'
binary: "/opt/firefox/firefox-bin"
chrome:
modules:
config:
WebDriver:
url: 'http://localhost/'
window_size: 1920*1080
browser: chrome
capabilities:
chromeOptions: # additional chrome options
args: ["--no-sandbox", "--disable-notifications", "--start-maximized", "--disk-cache-dir=null", "--aggressive-cache-discard", "--disable-dev-shm-usage"]
After a lot of trial-and-errors, we eventually fixed our problem using the following code. The code uses JS functionalities to find the width and height of an element, then moves the cursor and selects the top right corner (This is where we found out that its not selecting the top left corner) :
$width = 'var a = document.evaluate(\''.$class.'\', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.offsetWidth; return a;';
$width = $I->executeJS($width);
var_dump($width);
$height = 'var a = document.evaluate(\''.$class.'\', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.offsetHeight; return a;';
$height = $I->executeJS($height);
var_dump($height);
$I->moveMouseOver($class,(($width/2)),0);
$I->wait(1);
$I->clickWithLeftButton($class,(($width/2)),0);
Let me know if more information is needed.
- Lenguaje dominante
- PHP
- Estrellas
- 39
- Forks
- 23
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Codeception/module-webdriver
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Codeception/module-webdriver#151 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Codeception/module-webdriver#135 ·
-
Example of `executeAsyncJs()`Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
Codeception/module-webdriver#130 ·
-
Bug: `MalformedLocatorException` thrown for `id`s that don't start with a character (HTML 5)Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Codeception/module-webdriver#128 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
Codeception/module-webdriver#126 ·
Todos los issues de Codeception/module-webdriver
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
taskforcesh/bullmq#5238 ·
Los mantenedores suelen responder en 1 día
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itPosiblemente ocupada @bfs2021 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Automattic/jetpack#55517 ·
Los mantenedores suelen responder en 1 día
-
Address edit modal: what the customer types before the fields load is reset to the saved valueAbiertoMajor
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
PrestaShop/ps_onepagecheckout#245 ·
Los mantenedores suelen responder en 1 día
-
wpvc
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
10up/ElasticPress#4420 ·
Los mantenedores suelen responder en 1 día