@Test public void testSelectWindow() { execute("testcase_issue199"); assertThat(result, is(instanceOf(Success.class))); }
public String selectWindow(Context context, String windowID) { WebDriver driver = context.getWrappedDriver(); if (isNullWindowID(windowID)) return selectPreviousWindow(context); else if ("_blank".equals(windowID)) return selectBlankWindow(context); KeyValue wloc = KeyValue.parse(windowID, NO_PREFIX); switch (wloc.getKey()) { case NO_PREFIX: String handle = switchToWindow(driver, wloc.getValue()); if (handle != null) return handle; case "title": return selectWindowWithTitle(context, wloc.getValue()); case "name": case "handle": return switchToWindow(driver, wloc.getValue()); default: throw new UnsupportedOperationException(windowID); } }
WindowSelector { public String selectWindow(Context context, String windowID) { WebDriver driver = context.getWrappedDriver(); if (isNullWindowID(windowID)) return selectPreviousWindow(context); else if ("_blank".equals(windowID)) return selectBlankWindow(context); KeyValue wloc = KeyValue.parse(windowID, NO_PREFIX); switch (wloc.getKey()) { case NO_PREFIX: String handle = switchToWindow(driver, wloc.getValue()); if (handle != null) return handle; case "title": return selectWindowWithTitle(context, wloc.getValue()); case "name": case "handle": return switchToWindow(driver, wloc.getValue()); default: throw new UnsupportedOperationException(windowID); } } }
WindowSelector { public String selectWindow(Context context, String windowID) { WebDriver driver = context.getWrappedDriver(); if (isNullWindowID(windowID)) return selectPreviousWindow(context); else if ("_blank".equals(windowID)) return selectBlankWindow(context); KeyValue wloc = KeyValue.parse(windowID, NO_PREFIX); switch (wloc.getKey()) { case NO_PREFIX: String handle = switchToWindow(driver, wloc.getValue()); if (handle != null) return handle; case "title": return selectWindowWithTitle(context, wloc.getValue()); case "name": case "handle": return switchToWindow(driver, wloc.getValue()); default: throw new UnsupportedOperationException(windowID); } }  }
WindowSelector { public String selectWindow(Context context, String windowID) { WebDriver driver = context.getWrappedDriver(); if (isNullWindowID(windowID)) return selectPreviousWindow(context); else if ("_blank".equals(windowID)) return selectBlankWindow(context); KeyValue wloc = KeyValue.parse(windowID, NO_PREFIX); switch (wloc.getKey()) { case NO_PREFIX: String handle = switchToWindow(driver, wloc.getValue()); if (handle != null) return handle; case "title": return selectWindowWithTitle(context, wloc.getValue()); case "name": case "handle": return switchToWindow(driver, wloc.getValue()); default: throw new UnsupportedOperationException(windowID); } }  static void setInstance(WindowSelector ws); static WindowSelector getInstance(); String selectWindow(Context context, String windowID); String selectPopUp(Context context, String windowID); String selectPreviousWindow(Context context); String selectWindowWithTitle(Context context, String title); String selectBlankWindow(Context context); static void waitAfterSelectingWindowIfNeed(Context context); }
WindowSelector { public String selectWindow(Context context, String windowID) { WebDriver driver = context.getWrappedDriver(); if (isNullWindowID(windowID)) return selectPreviousWindow(context); else if ("_blank".equals(windowID)) return selectBlankWindow(context); KeyValue wloc = KeyValue.parse(windowID, NO_PREFIX); switch (wloc.getKey()) { case NO_PREFIX: String handle = switchToWindow(driver, wloc.getValue()); if (handle != null) return handle; case "title": return selectWindowWithTitle(context, wloc.getValue()); case "name": case "handle": return switchToWindow(driver, wloc.getValue()); default: throw new UnsupportedOperationException(windowID); } }  static void setInstance(WindowSelector ws); static WindowSelector getInstance(); String selectWindow(Context context, String windowID); String selectPopUp(Context context, String windowID); String selectPreviousWindow(Context context); String selectWindowWithTitle(Context context, String title); String selectBlankWindow(Context context); static void waitAfterSelectingWindowIfNeed(Context context);  }