Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing clicking outside of a viewport issue #389

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aik099
Copy link
Member

@aik099 aik099 commented Mar 2, 2024

Using the moveto WebDriver command the Firefox will trigger an \WebDriver\Exception\MoveTargetOutOfBounds exception when the element is outside of the viewport:

Move target (194, 1001) is out of bounds of viewport dimensions (1550, 970)

The moveto command is used in these driver methods:

  • clickOnElement
    • click (does clickOnElement internally)
    • check (does clickOnElement internally)
    • uncheck (does clickOnElement internally)
    • setValue (checkboxes only; does clickOnElement internally)
  • mouseOver
    • rightClick (does mouseOver internally)
    • doubleClick (does mouseOver internally)

.

The test suite isn't testing mouse-related operations (listed above) outside of the viewport.

P.S.

Copy link

codecov bot commented Mar 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.37%. Comparing base (a637df5) to head (b6823ea).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #389      +/-   ##
============================================
+ Coverage     90.19%   90.37%   +0.18%     
- Complexity      168      169       +1     
============================================
  Files             1        1              
  Lines           469      478       +9     
============================================
+ Hits            423      432       +9     
  Misses           46       46              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aik099 aik099 requested a review from stof March 16, 2024 19:50
{
$this->executeJsOnElement(
$element,
"arguments[0].scrollIntoView({ behavior: 'instant', block: 'end', inline: 'nearest' });"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use nearest as well in the block direction ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use the scrollIntoView method myself. I've only copied the whole line from the PHP WebDriver (see https://github.com/php-webdriver/php-webdriver/blob/11923b4ba312fc9d137266ae67438be65d4d500f/lib/Remote/RemoteWebElement.php#L249 ). I trust that they know what's right here.

@aik099 aik099 force-pushed the firefox-scroll-into-view-fix branch from b6823ea to a65aa40 Compare October 31, 2024 12:21
@aik099
Copy link
Member Author

aik099 commented Oct 31, 2024

Not merging yet, because I think we need to add a missing test in driver-testsuite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants