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:
parent
640db99c27
commit
e30e6cba8e
3 changed files with 1 additions and 27 deletions
|
@ -144,11 +144,6 @@
|
||||||
<artifactId>selenium-edge-driver</artifactId>
|
<artifactId>selenium-edge-driver</artifactId>
|
||||||
<version>${selenium.version}</version>
|
<version>${selenium.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.seleniumhq.selenium</groupId>
|
|
||||||
<artifactId>selenium-safari-driver</artifactId>
|
|
||||||
<version>${selenium.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.seleniumhq.selenium</groupId>
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
<artifactId>selenium-remote-driver</artifactId>
|
<artifactId>selenium-remote-driver</artifactId>
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.chrome.ChromeDriver;
|
import org.openqa.selenium.chrome.ChromeDriver;
|
||||||
import org.openqa.selenium.edge.EdgeDriver;
|
import org.openqa.selenium.edge.EdgeDriver;
|
||||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
import org.openqa.selenium.safari.SafariDriver;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine which WebDriver is used
|
* Determine which WebDriver is used
|
||||||
|
@ -45,8 +44,4 @@ public class BrowserDriverUtil {
|
||||||
public static boolean isDriverEdge(WebDriver driver) {
|
public static boolean isDriverEdge(WebDriver driver) {
|
||||||
return isDriverInstanceOf(driver, EdgeDriver.class);
|
return isDriverInstanceOf(driver, EdgeDriver.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDriverSafari(WebDriver driver) {
|
|
||||||
return isDriverInstanceOf(driver, SafariDriver.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
import org.openqa.selenium.interactions.Actions;
|
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.ExpectedConditions;
|
||||||
import org.openqa.selenium.support.ui.Select;
|
import org.openqa.selenium.support.ui.Select;
|
||||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||||
|
@ -74,14 +73,8 @@ public final class UIUtils {
|
||||||
|
|
||||||
waitUntilElement(element).is().clickable();
|
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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is as an alternative for {@link #clickLink(WebElement)} and should be used in situations where we can't use
|
* This is as an alternative for {@link #clickLink(WebElement)} and should be used in situations where we can't use
|
||||||
|
@ -153,15 +146,6 @@ public final class UIUtils {
|
||||||
*/
|
*/
|
||||||
public static String getTextFromElement(WebElement element) {
|
public static String getTextFromElement(WebElement element) {
|
||||||
String text = element.getText();
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue