本文整理汇总了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();
}
示例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();
}
示例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));
}
}
示例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));
}
}
示例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;
}
}
示例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();
}
示例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;
}
示例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) {
}
}
示例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;
}