public class SelectAllRowsTest extends MultiBrowserTest {
- private final static String TABLE_ROW = "v-table-row";
-
@Override
- protected DesiredCapabilities getDesiredCapabilities() {
- DesiredCapabilities cap = new DesiredCapabilities(
- super.getDesiredCapabilities());
- cap.setCapability("requireWindowFocus", true);
- return cap;
+ protected boolean requireWindowFocusForIE() {
+ return true;
}
@Override
private void setupRemoteDriver(DesiredCapabilities capabilities)
throws Exception {
if (BrowserUtil.isIE(capabilities)) {
- capabilities.setCapability(
- InternetExplorerDriver.REQUIRE_WINDOW_FOCUS,
- requireWindowFocusForIE());
- capabilities.setCapability(
- InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
- usePersistentHoverForIE());
+ if (requireWindowFocusForIE()) {
+ capabilities.setCapability(
+ InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
+ }
+ if (!usePersistentHoverForIE()) {
+ capabilities.setCapability(
+ InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING,
+ false);
+ }
}
WebDriver dr = TestBench.createDriver(new RemoteWebDriver(new URL(
* @param desiredCapabilities
*/
public void setDesiredCapabilities(DesiredCapabilities desiredCapabilities) {
- this.desiredCapabilities = desiredCapabilities;
+ // Make a copy as the desired capabilities can come from a shared,
+ // static resource. This will cause all kinds of problems if some test
+ // modifies the capabilities
+ this.desiredCapabilities = new DesiredCapabilities(desiredCapabilities);
}
/**
* Checks if the given capabilities refer to Internet Explorer 8
*
* @param capabilities
+ * @param version
* @return true if the capabilities refer to IE8, false otherwise
*/
public static boolean isIE8(DesiredCapabilities capabilities) {
- return isIE(capabilities) && "8".equals(capabilities.getVersion());
+ return isIE(8, capabilities);
+ }
+
+ /**
+ * Checks if the given capabilities refer to Internet Explorer of the
+ * given version
+ *
+ * @param capabilities
+ * @param version
+ * @return true if the capabilities refer to IE of the given version,
+ * false otherwise
+ */
+ public static boolean isIE(int version, DesiredCapabilities capabilities) {
+ return isIE(capabilities)
+ && ("" + version).equals(capabilities.getVersion());
}
/**