click Function does not correspond to top-left corner of the element
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, php
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện clickWithLeftButton và moveMouseOver với cấu hình Firefox, Selenium và geckodriver được cung cấp, đồng thời so sánh hành vi offset với Chrome. Sử dụng các phép đo offset bằng JavaScript được cung cấp làm tài liệu tham chiếu; được coi là hoàn tất khi offset được yêu cầu chọn đúng góc dự kiến của phần tử trong các bài kiểm thử chấp nhận của Firefox.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 39
- Fork
- 25
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Codeception/module-webdriver
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Codeception/module-webdriver#151 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Codeception/module-webdriver#135 ·
-
Example of `executeAsyncJs()` Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
Codeception/module-webdriver#130 ·
-
Bug: `MalformedLocatorException` thrown for `id`s that don't start with a character (HTML 5) Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Codeception/module-webdriver#128 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
Codeception/module-webdriver#126 ·
Tất cả issue của Codeception/module-webdriver
Issue tương tự
-
status/awaiting_triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
WordPress/plugin-check#1486 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
az-digital/az_quickstart#6019 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
grokability/snipe-it#19688 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100