Search in sources :

Example 1 with Rect

use of com.qaprosoft.carina.core.foundation.utils.metadata.model.Rect in project carina by qaprosoft.

the class ExtendedWebElement method getElementInfo.

@SuppressWarnings("unchecked")
private ElementInfo getElementInfo(ExtendedWebElement extendedWebElement) {
    ElementInfo elementInfo = new ElementInfo();
    if (extendedWebElement.isElementPresent(1)) {
        Point location = extendedWebElement.getElement().getLocation();
        Dimension size = extendedWebElement.getElement().getSize();
        elementInfo.setRect(new Rect(location.getX(), location.getY(), size.getWidth(), size.getHeight()));
        elementInfo.setElementsAttributes((Map<String, String>) ((RemoteWebDriver) driver).executeScript(ATTRIBUTE_JS, extendedWebElement.getElement()));
        try {
            elementInfo.setText(extendedWebElement.getText());
        } catch (Exception e) {
            elementInfo.setText("");
        }
        return elementInfo;
    } else {
        return null;
    }
}
Also used : Rect(com.qaprosoft.carina.core.foundation.utils.metadata.model.Rect) ElementInfo(com.qaprosoft.carina.core.foundation.utils.metadata.model.ElementInfo) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException)

Aggregations

ElementInfo (com.qaprosoft.carina.core.foundation.utils.metadata.model.ElementInfo)1 Rect (com.qaprosoft.carina.core.foundation.utils.metadata.model.Rect)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1