com.github.siwenyan.si.SiCommandExecutorOpen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of side Show documentation
Show all versions of side Show documentation
Java runner of Selenium IDE project
package com.github.siwenyan.si;
class SiCommandExecutorOpen extends SiCommandExecutor implements ISiCommandExecutorFlagUi {
@Override
public void execute(SiCommand command, SiContext siContext) throws SiVerifyException, SiWebDriverException {
String target = command.getSiModelCommand().getTarget();
target = siContext.dynamic(target, "", "");
siContext.getReporter().reportMessage("url: " + target);
String url = null;
if (target.startsWith("http")) {
url = target;
} else {
String baseUrl = siContext.getUrl();
siContext.getReporter().reportMessage("endpoint: " + baseUrl + target);
url = baseUrl + target;
}
try {
siContext.asWebDriver().get(url);
try {
siContext.asWebDriver().switchTo().alert().accept();
} catch (Exception e) {
// do nothing
}
} catch (Exception e) {
try {
siContext.asWebDriver().switchTo().alert().accept();
} catch (Exception e1) {
//do nothing;
}
siContext.asWebDriver().get(url);
}
}
@Override
public void beforeExecute(SiCommand command, SiContext siContext) throws SiVerifyException, SiWebDriverException {
super.beforeExecute(command, siContext);
siContext.clearAlert();
}
@Override
public void afterExecute(SiCommand command, SiContext siContext) throws SiVerifyException, SiWebDriverException {
siContext.clearAlert();
super.afterExecute(command, siContext);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy