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

[plugin-web-app] Retry mouse clicks if element position is changed during click #4651

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ private void tryToWorkaroundException(WebElement element, ClickResult clickResul
WebElement page, WebDriverException webDriverException)
{
String message = webDriverException.getMessage();
if (message.contains("is not clickable at point") && message.contains("Other element would receive the click"))
/*
- Element is overlapped with another one: Other element would receive the click
- Page has dynamically loaded content which results in invalid (sometimes negative) coordinates for click, e.g:
Element is not clickable at point (498, -377)
Element is not clickable at point (550, -11228)
*/
if (message.contains("is not clickable at point"))
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,6 @@ void shouldNotRetryClickOnMatchingError()
testClickWithElementNotClickableException();
}

@Test
void shouldNotRetryClickOnNonMatchingError()
{
mockBodySearch();

WebDriverException e = new WebDriverException(ELEMENT_IS_NOT_CLICKABLE_AT_POINT);
doThrow(e).doNothing().when(webElement).click();
WebDriverException exception = assertThrows(WebDriverException.class, () -> mouseActions.click(webElement));
assertThat(exception.getMessage(), containsString(ELEMENT_IS_NOT_CLICKABLE_AT_POINT));
}

private WebElement mockBodySearch()
{
when(webDriverProvider.get()).thenReturn(webDriver);
Expand Down
Loading