click Function does not correspond to top-left corner of the element
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, php
- 領域
- testing-qa
調査の方向性
まず、提供された Firefox、Selenium、geckodriver の設定で clickWithLeftButton と moveMouseOver を再現し、Chrome と offset の挙動を比較します。提供された JavaScript の offset 測定値を参照として使用します。Firefox の受け入れテストで、要求された offset によって意図した要素の角が選択されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- PHP
- スター
- 39
- フォーク
- 25
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Codeception/module-webdriver のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Codeception/module-webdriver#151 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
Codeception/module-webdriver#135 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
Codeception/module-webdriver#130 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
Codeception/module-webdriver#128 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
Codeception/module-webdriver#126 ·
Codeception/module-webdriver の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
a11y admissions.uiowa.edu needs grooming SiteImprove best practice
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Save States Menu オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
pluginsGLPI/datainjection#673 ·