com.github.siwenyan.si.SiCommandExecutorStoreXpathCount 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;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
class SiCommandExecutorStoreXpathCount extends SiCommandExecutor {
@Override
public void execute(SiCommand command, SiContext siContext) throws SiVerifyException, SiWebDriverException {
String xpath = siContext.dynamic(command.getSiModelCommand().getTarget(), "", "");
List els = siContext.asWebDriver().findElements(By.xpath(xpath));
String name = command.getSiModelCommand().getValue();
String value = "" + (null == els ? 0 : els.size());
siContext.getReporter().reportMessage("name: " + name);
siContext.getReporter().reportMessage("value: " + value);
siContext.addVar(name, value);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy