當前位置: 首頁>>代碼示例>>Java>>正文


Java WebElement.isEnabled方法代碼示例

本文整理匯總了Java中org.openqa.selenium.WebElement.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java WebElement.isEnabled方法的具體用法?Java WebElement.isEnabled怎麽用?Java WebElement.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openqa.selenium.WebElement的用法示例。


在下文中一共展示了WebElement.isEnabled方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: check

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
/**
 * Check the check box
 */
@Override
@PublicAtsApi
public void check() {

    new RealHtmlElementState(this).waitToBecomeExisting();

    WebElement checkBoxElement = RealHtmlElementLocator.findElement(this);
    if (!checkBoxElement.isEnabled()) {
        throw new UnsupportedOperationException("You may not check a disabled element."
                                                + toString());
    }
    if (!checkBoxElement.isSelected()) {
        checkBoxElement.click();
    }

    UiEngineUtilities.sleep();
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:21,代碼來源:RealHtmlCheckBox.java

示例2: unCheck

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
/**
 * Uncheck the check box
 */
@Override
@PublicAtsApi
public void unCheck() {

    new RealHtmlElementState(this).waitToBecomeExisting();

    WebElement checkBoxElement = RealHtmlElementLocator.findElement(this);
    if (!checkBoxElement.isEnabled()) {
        throw new UnsupportedOperationException("You may not uncheck a disabled element."
                                                + toString());
    }
    if (checkBoxElement.isSelected()) {
        checkBoxElement.click();
    }

    UiEngineUtilities.sleep();
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:21,代碼來源:RealHtmlCheckBox.java

示例3: run

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
@Override
public void run() {

    super.run();

    By locator = this.readLocatorArgument("locator");

    this.waitForAsyncCallsToFinish();

    WebElement element = this.getElement(locator);
    if (!element.isEnabled()) {
        throw new RuntimeException(String.format(
                "Assertion failed: element %s was not enabled",
                locator));
    }
}
 
開發者ID:mcdcorp,項目名稱:opentest,代碼行數:17,代碼來源:AssertElementEnabled.java

示例4: run

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
@Override
public void run() {

    super.run();

    By locator = this.readLocatorArgument("locator");

    this.waitForAsyncCallsToFinish();

    WebElement element = this.getElement(locator);
    if (element.isEnabled()) {
        throw new RuntimeException(String.format(
                "Assertion failed: element %s was not disabled",
                locator));
    }
}
 
開發者ID:mcdcorp,項目名稱:opentest,代碼行數:17,代碼來源:AssertElementDisabled.java

示例5: isElementExist

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
/**
 * 判斷元素是否存在
 *
 * @param webElement
 * @return
 */
public boolean isElementExist(WebElement webElement) {
    try {
        webElement.isEnabled();
        return true;
    } catch (NoSuchElementException e) {
        return false;
    }
}
 
開發者ID:ychaoyang,項目名稱:autotest,代碼行數:15,代碼來源:WebTestBase.java

示例6: select

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
/**
 * set the selected value
 *
 * @param value the value to select(this is the 'value' attribute of the radio button)
 */
@PublicAtsApi
public void select(
                    String value ) {

    new RealHtmlElementState(this).waitToBecomeExisting();

    WebElement element = RealHtmlElementLocator.findElement(this, "[@value='" + value + "']", true);
    if (!element.isEnabled()) {
        throw new UnsupportedOperationException("You may not select a disabled element." + toString());
    }
    element.click();

    UiEngineUtilities.sleep();
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:20,代碼來源:RealHtmlRadioList.java

示例7: waitForButton

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
private WebElement waitForButton(WebElementFacade buttonFacade) {
    WebElement button = buttonFacade.withTimeoutOf(10, TimeUnit.SECONDS).waitUntilEnabled();

    if (!button.isEnabled()) {
        button = buttonFacade.withTimeoutOf(10, TimeUnit.SECONDS).waitUntilEnabled().waitUntilVisible();
    }

    return button;
}
 
開發者ID:Comcast,項目名稱:redirector,代碼行數:10,代碼來源:DistributionPage.java

示例8: webButtonClick

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
/**
 * Web button click.
 *
 * @param driver the driver
 * @param logger the logger
 * @param element the element
 */
public static void webButtonClick(WebDriver driver, ExtentTest logger, WebElement element) {
	try {
		if (element != null && element.isEnabled()) {
			element.click();
		}
	} catch (Exception e) {
		}
}
 
開發者ID:anilpandeykiet,項目名稱:POM_HYBRID_FRAMEOWRK,代碼行數:16,代碼來源:WebButton.java

示例9: isWebInputEditable

import org.openqa.selenium.WebElement; //導入方法依賴的package包/類
/**
 * Checks if is web input editable.
 *
 * @param element
 *            the element
 * @return true, if is web input editable
 */
public static boolean isWebInputEditable(WebElement element) {
	boolean visibilityStatus = false;
	try {
		if (element != null) {
			visibilityStatus = element.isEnabled();
		}
	} catch (Exception e) {
		// nothing can be done at this point
	}
	return visibilityStatus;
}
 
開發者ID:anilpandeykiet,項目名稱:POM_HYBRID_FRAMEOWRK,代碼行數:19,代碼來源:WebTextbox.java


注:本文中的org.openqa.selenium.WebElement.isEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。