-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conditions object on FluentWebElement as ExpectedConditions wrapper
- Loading branch information
Showing
6 changed files
with
383 additions
and
92 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/FluentConditions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.fluentlenium.core.conditions; | ||
|
||
import org.fluentlenium.adapter.FluentAdapter; | ||
import org.fluentlenium.core.FluentThread; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
|
||
/** | ||
* Fluent object to handle {@link org.openqa.selenium.support.ui.ExpectedConditions} on FluentWebElement in fluentlenium API. | ||
*/ | ||
public class FluentConditions { | ||
private WebElement element; | ||
|
||
public FluentConditions(WebElement element) { | ||
this.element = element; | ||
} | ||
|
||
/** | ||
* Check that this element is visible and enabled such that you can click it. | ||
* | ||
* @return true if the element can be clicked, false otherwise. | ||
*/ | ||
public boolean isClickable() { | ||
FluentAdapter fluent = FluentThread.get(); | ||
return ExpectedConditions.elementToBeClickable(element).apply(fluent.getDriver()) != null; | ||
} | ||
|
||
/** | ||
* Check that this element is no longer attached to the DOM. | ||
* | ||
* @return false is the element is still attached to the DOM, true otherwise. | ||
*/ | ||
public boolean isStale() { | ||
FluentAdapter fluent = FluentThread.get(); | ||
return ExpectedConditions.stalenessOf(element).apply(fluent.getDriver()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.