[java-idp-integration-tests] branch main updated: Workaround lack of Safari support for Actions
Tom Zeller
tzeller at dragonacea.biz
Sun Jul 14 20:42:42 UTC 2024
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch main
in repository java-idp-integration-tests.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=2701d952a876e5d875638bac287d2c9e56de5e04
The following commit(s) were added to refs/heads/main by this push:
new 2701d95 Workaround lack of Safari support for Actions
2701d95 is described below
commit 2701d952a876e5d875638bac287d2c9e56de5e04
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Sun Jul 14 15:42:32 2024 -0500
Workaround lack of Safari support for Actions
Apparently the Safari driver does not support the Selenium Actions API.
So catch the exception thrown in that case and resort to JavaScript to
move to the element on the page.
---
.../shibboleth/idp/integration/tests/BaseIntegrationTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
index cad9f0d..c290c52 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
@@ -70,6 +70,7 @@ import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Point;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
@@ -2298,15 +2299,17 @@ public abstract class BaseIntegrationTest {
// Try clicking element
log.trace("Attempting to click element '{}'", element);
element.click();
- } catch (ElementNotInteractableException e) {
- log.trace("Unable to click element '{}', will try again", element);
+ } catch (WebDriverException e) {
+ log.trace("Unable to click element '{}', will try using Actions", element);
final Actions action = new Actions(driver);
// Try moving to element and clicking, element must be in viewport
try {
log.trace("Attempting to move to element and click '{}'", element);
action.moveToElement(element).click().perform();
} catch (org.openqa.selenium.interactions.MoveTargetOutOfBoundsException e1) {
- log.trace("Unable to move to element '{}', will try again", element);
+ log.trace("Unable to move to element '{}' out of bounds, will try JavaScript", element);
+ } catch (StaleElementReferenceException e1) {
+ log.trace("Unable to move to element '{}' stale reference, will try JavaScript", element);
}
// If element is still not clicked, try JavaScript
if ((isSelected && element.isSelected()) || (!isSelected && !element.isSelected())) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list