Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make components works with injection.
It also add hooks support of WebElement and List<WebElement>. Close #312
- Loading branch information
Showing
8 changed files
with
318 additions
and
36 deletions.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
fluentlenium-core/src/main/java/org/fluentlenium/core/inject/ContainerContext.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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
package org.fluentlenium.core.inject; | ||
|
||
import org.fluentlenium.core.hook.HookDefinition; | ||
import org.openqa.selenium.SearchContext; | ||
|
||
import java.util.List; | ||
|
||
public interface ContainerContext { | ||
Object getContainer(); | ||
|
||
ContainerContext getParent(); | ||
|
||
SearchContext getSearchContext(); | ||
|
||
List<HookDefinition<?>> getHookDefinitions(); | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...ntlenium-core/src/main/java/org/fluentlenium/core/inject/ElementLocatorSearchContext.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,35 @@ | ||
package org.fluentlenium.core.inject; | ||
|
||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.SearchContext; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.pagefactory.ElementLocator; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ElementLocatorSearchContext implements SearchContext { | ||
private final ElementLocator locator; | ||
|
||
public ElementLocatorSearchContext(ElementLocator locator) { | ||
this.locator = locator; | ||
} | ||
|
||
@Override | ||
public List<WebElement> findElements(By by) { | ||
List<WebElement> elements = new ArrayList<>(); | ||
|
||
List<WebElement> baseElements = locator.findElements(); | ||
|
||
for (WebElement element : baseElements) { | ||
elements.addAll(element.findElements(by)); | ||
} | ||
|
||
return elements; | ||
} | ||
|
||
@Override | ||
public WebElement findElement(By by) { | ||
return locator.findElement().findElement(by); | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
fluentlenium-core/src/main/java/org/fluentlenium/core/inject/Parent.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,14 @@ | ||
package org.fluentlenium.core.inject; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.CONSTRUCTOR; | ||
import static java.lang.annotation.ElementType.FIELD; | ||
import static java.lang.annotation.ElementType.METHOD; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
|
||
@Target({METHOD, CONSTRUCTOR, FIELD}) | ||
@Retention(RUNTIME) | ||
public @interface Parent { | ||
} |
Oops, something went wrong.