private void switchWindow(String windowKey) throws FailureException, TechnicalException {
        String handleToSwitch = Context.getWindows().get(windowKey);
        if (handleToSwitch != null) {
            Context.getDriver().switchTo().window(handleToSwitch);
            // As a workaround: NoraUi specify window size manually, e.g. window_size: 1920 x 1080 (instead of .window().maximize()).
            Context.getDriver().manage().window().setSize(new Dimension(1920, 1080));
            Context.setMainWindow(windowKey);
        } else {
            new Result.Failure<>(windowKey, Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW), windowKey), true, Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
        }
    }
private void switchWindow ( String windowKey ) throws FailureException , TechnicalException { String handleToSwitch = Context . getWindows ( ) . get ( windowKey ) ; if ( handleToSwitch != null ) { Context . getDriver ( ) . switchTo ( ) . window ( handleToSwitch ) ; Context . getDriver ( ) . manage ( ) . window ( ) . setSize ( new Dimension ( 1920 , 1080 ) ) ; Context . setMainWindow ( windowKey ) ; } else { new Result . Failure < > ( windowKey , Messages . format ( Messages . getMessage ( Messages . FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW ) , windowKey ) , true , Context . getCallBack ( Callbacks . RESTART_WEB_DRIVER ) ) ; } }
@param windowKey
the key of window (popup, ...) Example: GEOBEER.
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_SWITCH_WINDOW} message (with screenshot, with exception)
@throws FailureException
if the scenario encounters a functional error