Remove Safari from supported web drivers (#30424)

Related to #29921

Signed-off-by: wojnarfilip <fwojnar@redhat.com>
Co-authored-by: wojnarfilip <fwojnar@redhat.com>
This commit is contained in:
fwojnar 2024-06-24 13:27:12 +02:00 committed by GitHub
parent 640db99c27
commit e30e6cba8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 27 deletions

View file

@ -144,11 +144,6 @@
<artifactId>selenium-edge-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-safari-driver</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>

View file

@ -21,7 +21,6 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.safari.SafariDriver;
/**
* Determine which WebDriver is used
@ -45,8 +44,4 @@ public class BrowserDriverUtil {
public static boolean isDriverEdge(WebDriver driver) {
return isDriverInstanceOf(driver, EdgeDriver.class);
}
public static boolean isDriverSafari(WebDriver driver) {
return isDriverInstanceOf(driver, SafariDriver.class);
}
}

View file

@ -11,7 +11,6 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
@ -74,13 +73,7 @@ public final class UIUtils {
waitUntilElement(element).is().clickable();
if (driver instanceof SafariDriver && !element.isDisplayed()) { // Safari sometimes thinks an element is not visible
// even though it is. In this case we just move the cursor and click.
performOperationWithPageReload(() -> new Actions(driver).click(element).perform());
}
else {
performOperationWithPageReload(element::click);
}
performOperationWithPageReload(element::click);
}
/**
@ -153,15 +146,6 @@ public final class UIUtils {
*/
public static String getTextFromElement(WebElement element) {
String text = element.getText();
if (getCurrentDriver() instanceof SafariDriver) {
try {
// Safari on macOS doesn't comply with WebDriver specs yet again - getText() retrieves hidden text by CSS.
text = element.findElement(By.xpath("./span[not(contains(@class,'ng-hide'))]")).getText();
} catch (NoSuchElementException e) {
// no op
}
return text.trim(); // Safari on macOS sometimes for no obvious reason surrounds the text with spaces
}
return text;
}