List of usage examples for org.openqa.selenium WebElement getAttribute
String getAttribute(String name);
From source file:com.cognifide.qa.bb.aem.touch.siteadmin.aem61.conditions.NotDisabledCondition.java
License:Apache License
@Override public boolean check(Object subject, LoadableComponent data) { WebElement createButton = (WebElement) subject; return wait.withTimeout(data.timeout()) .until(input -> Objects.isNull(createButton.getAttribute("disabled")), data.delay()); }
From source file:com.cognifide.qa.bb.aem.touch.util.Conditions.java
License:Apache License
/** * Examines if element has attribute value like one passed in parameter. * * @param element {@link WebElement} instance that is going to be examined. * @param attribute attribute which value will be tested. * @param value expected value of the element attribute * @return true if the element has attribute value like one passed in parameter. *///from w w w .ja v a 2 s . co m public boolean hasAttributeWithValue(final WebElement element, final String attribute, final String value) { boolean result = true; try { bobcatWait.withTimeout(Timeouts.SMALL).until(input -> element.getAttribute(attribute).contains(value)); } catch (TimeoutException e) { result = false; } return result; }
From source file:com.cognifide.qa.bb.aem.ui.AemContentFinder.java
License:Apache License
/** * @return Name of the currently selected tab, e.g. Images, Documents */// ww w . j a va2s .c o m public String getCurrentTabName() { WebElement findElement = iconBar.findElement(By.xpath(".//li[contains(@class,'x-tab-strip-active')]")); String id = findElement.getAttribute("id"); return StringUtils.substringAfterLast(id, "-"); }
From source file:com.cognifide.qa.bb.aem.ui.AemContentFinderTab.java
License:Apache License
private boolean isSelected(WebElement button) { WebElement table = button.findElement(By.xpath("./ancestor::table[1]")); return table.getAttribute(HtmlTags.Attributes.CLASS).contains("x-btn-pressed"); }
From source file:com.cognifide.qa.bb.aem.ui.AemDialog.java
License:Apache License
private WebElement getActiveTab() { List<WebElement> tabs = getAllTabs(); for (WebElement tab : tabs) { WebElement tabState = tab.findElement(By.xpath(".//../../../..")); if (tabState.getAttribute(HtmlTags.Attributes.CLASS).contains("x-tab-strip-active")) { return tab; }//from w w w . j a v a 2 s . c o m } throw new IllegalStateException("There are no active tabs in the current dialog"); }
From source file:com.cognifide.qa.bb.aem.ui.wcm.windows.CreateSiteWindow.java
License:Apache License
private void clickLanguageCheckBox(String language) { WebElement span = currentWindow.findElement(By.xpath("//span[contains(text(),'" + language + "')]")); WebElement label = span.findElement(By.xpath("..")); WebElement checkBox = currentWindow.findElement(By.id(label.getAttribute("for"))); checkBox.click();//from w w w. j av a2 s . c o m }
From source file:com.cognifide.qa.bb.expectedconditions.CommonExpectedConditions.java
License:Apache License
/** * Check if element has attribute with provided value * * @param attributeName name of the attribute * @param attributeValue value of the attribute * @param element WebElement to check//from w w w . j a v a 2s . co m * @return true if element has attribute with provided value */ public static ExpectedCondition<Boolean> elementHasAttributeWithValue(final WebElement element, final String attributeName, final String attributeValue) { return driver -> StringUtils.defaultString(element.getAttribute(attributeName)).equals(attributeValue); }
From source file:com.cognifide.qa.bb.logging.WebDriverLogger.java
License:Apache License
@Override public void beforeChangeValueOf(WebElement element, WebDriver driver, CharSequence[] keysToSend) { StringBuilder sb = new StringBuilder(); sb.append(element.toString());/*from w w w. j a va2s.c o m*/ sb.append(" value: ["); sb.append(element.getAttribute("value")); sb.append("] -> ["); beforeEvent("changeValue", sb.toString()); }
From source file:com.cognifide.qa.bb.logging.WebDriverLogger.java
License:Apache License
@Override public void afterChangeValueOf(WebElement element, WebDriver driver, CharSequence[] keysToSend) { afterEvent(element.getAttribute("value") + "]"); }
From source file:com.cognifide.qa.bb.utils.WebElementUtils.java
License:Apache License
/** * Checks if specified WebElement has specified attribute within specified timeout. * * @param element WebElement to be checked. * @param attribute name of the attribute which presence is to be checked. * @param timeout timeout in seconds within which the WebElement has to have specified * attribute.//from w w w .j a v a 2s . c om * @return value indicating if specified WebElement has specified attribute. */ public boolean hasAttribute(final WebElement element, final String attribute, int timeout) { return isConditionMet(webDriver -> element.getAttribute(attribute) != null, timeout); }