Package com.thoughtworks.selenium

Examples of com.thoughtworks.selenium.SeleniumException


    }

    @Override
    public void setLogRecorder(LogRecorder logRecorder) {
        if (this.logRecorder != null)
            throw new SeleniumException("The log recorder of " + this + " is already set.");
        this.logRecorder = logRecorder;
    }
View Full Code Here


        if (key == null) {
            index = commandList.size();
        } else {
            index = commandList.indexOf(key);
            if (index == -1)
                throw new SeleniumException("Cannot jump to " + key);
        }
        iterator = commandList.originalListIterator(index);
    }
View Full Code Here

        if (key == null) {
            index = commandList.size();
        } else {
            index = commandList.indexOf(key);
            if (index == -1)
                throw new SeleniumException("Cannot jump to next of " + key);
            index++;
        }
        iterator = commandList.originalListIterator(index);
    }
View Full Code Here

        if (!url.contains("://")) {
            String baseURL = context.getCurrentBaseURL();
            try {
                url = new URI(baseURL).resolve(url).toASCIIString();
            } catch (URISyntaxException e) {
                throw new SeleniumException("Invalid URL: baseURL=[" + baseURL + "] / parameter=[" + url + "]", e);
            }
        }
        context.getWrappedDriver().get(url);
        return SUCCESS;
    }
View Full Code Here

            String name = StringUtils.uncapitalize(cmdClass.getSimpleName());
            Constructor<? extends ICommand> constructor;
            constructor = cmdClass.getDeclaredConstructor(int.class/*index*/, String.class/*name*/, String[].class/*args*/);
            constructorMap.put(name, constructor);
        } catch (Exception e) {
            throw new SeleniumException(e);
        }
    }
View Full Code Here

        Constructor<? extends ICommand> constructor = constructorMap.get(realName);
        if (constructor != null) {
            try {
                return constructor.newInstance(index, name, args);
            } catch (Exception e) {
                throw new SeleniumException(e);
            }
        }

        // command supported by WebDriverCommandProcessor
        SubCommandMap subCommandMap = context.getSubCommandMap();
        ISubCommand<?> subCommand = subCommandMap.get(realName);
        if (subCommand != null)
            return new BuiltInCommand(index, name, args, subCommand, andWait);

        // FIXME #32 workaround alert command handling.
        if (realName.matches("(?i)(?:assert|verify|waitFor)(?:Alert|Confirmation|Prompt)(?:(?:Not)?Present)?")) {
            StringBuilder echo = new StringBuilder(name);
            for (String arg : args)
                echo.append(" ").append(arg);
            return new Echo(index, name, echo.toString());
        }

        // See: http://selenium.googlecode.com/svn/trunk/ide/main/src/content/selenium-core/reference.html
        // Assertion or Accessor
        Matcher matcher = COMMAND_PATTERN.matcher(name);
        if (!matcher.matches())
            throw new SeleniumException("No such command: " + name);
        String assertion = matcher.group(ASSERTION);
        String target = matcher.group(TARGET);
        if (target == null)
            target = "Expression";
        if (matcher.group(PRESENT) != null)
            target += "Present";
        boolean isBoolean = false;
        String getter = "get" + target;
        ISubCommand<?> getterSubCommand = subCommandMap.get(getter);
        if (getterSubCommand == null) {
            getter = "is" + target;
            getterSubCommand = subCommandMap.get(getter);
            if (getterSubCommand == null)
                throw new SeleniumException("No such command: " + name);
            isBoolean = true;
        }
        if (assertion != null) {
            boolean isInverse = matcher.group(IS_INVERSE) != null || matcher.group(IS_PRESENT_INVERSE) != null;
            return new Assertion(index, name, args, assertion, getterSubCommand, isBoolean, isInverse);
View Full Code Here

        if (ruleMap.containsKey("expandedCommands")) {
            log.info("- Expanded commands: array");
        } else if (ruleMap.containsKey("getExpandedCommands")) {
            log.info("- Expanded commands: function");
        } else {
            throw new SeleniumException("Missing expandedCommands nor getExpandedCommands in rollup rule definition.");
        }
    }
View Full Code Here

                bindings.put("rule", rule);
            String args = new JSONObject(rollupArgs).toString();
            try {
                commands = JSList.toList(engine, engine.eval("rule.getExpandedCommands(" + args + ")", bindings));
            } catch (ScriptException e) {
                throw new SeleniumException(e);
            }
        }
        ICommandFactory factory = context.getCommandFactory();
        CommandList commandList = Binder.newCommandList();
        int index = 0;
View Full Code Here

     */
    public RollupRules() {
        engine = new ScriptEngineManager().getEngineByExtension("js");
        // some OpenJDK7 installations have lack of JavaScript support
        if (engine == null)
            throw new SeleniumException("Script engine not found for js");
        String engineName = engine.getFactory().getEngineName();
        EngineType engineType = null;
        for (EngineType et : EngineType.values()) {
            if (et.matches(engineName)) {
                engineType = et;
                break;
            }
        }
        if (engineType == null)
            throw new SeleniumException("Unknown script engine: " + engineName);
        this.engineType = engineType;
    }
View Full Code Here

                        engine.eval("load('nashorn:mozilla_compat.js');");
                    engine.eval("importPackage(Packages." + packageName + ");");
                    r = new InputStreamReader(is, Charsets.UTF_8);
                    engine.eval(r);
                } catch (ScriptException e) {
                    throw new SeleniumException(e);
                } finally {
                    IOUtils.closeQuietly(r);
                }
            }
        });
View Full Code Here

TOP

Related Classes of com.thoughtworks.selenium.SeleniumException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.