Skip to content

Commit

Permalink
Merge pull request #181 from healenium/feature/EPMHLM-218
Browse files Browse the repository at this point in the history
Feature/epmhlm 218
  • Loading branch information
Alex-Reif authored Mar 24, 2022
2 parents aeee4ac + 959661c commit e52aca2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.epam.healenium</groupId>
<artifactId>healenium-web</artifactId>
<version>3.2.3</version>
<version>3.2.4</version>
<packaging>jar</packaging>
<name>healenium-web</name>
<description>healenium web client</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected PageAwareBy awareBy(By by) {
return (by instanceof PageAwareBy) ? (PageAwareBy) by : PageAwareBy.by(driver.getTitle(), by);
}

protected WebElement wrapElement(WebElement element, ClassLoader loader) {
public WebElement wrapElement(WebElement element, ClassLoader loader) {
WebElementProxyHandler elementProxyHandler = new WebElementProxyHandler(element, engine);
return ProxyFactory.createWebElementProxy(loader, elementProxyHandler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
ClassLoader loader = driver.getClass().getClassLoader();
if ("findElement".equals(method.getName())) {
WebElement element = findElement((By) args[0]);
return Optional.ofNullable(element).map(it -> wrapElement(it, loader)).orElse(null);
return engine.isProxy()
? element
: Optional.ofNullable(element).map(it -> wrapElement(it, loader)).orElse(null);
}
if ("findElements".equals(method.getName())) {
List<WebElement> elements = findElements((By) args[0]);
return elements.stream().map(it -> wrapElement(it, loader)).collect(Collectors.toList());
return engine.isProxy()
? elements
: elements.stream().map(it -> wrapElement(it, loader)).collect(Collectors.toList());
}
if ("getWrappedElement".equals(method.getName())) {
return delegate;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
recovery-tries = 3
recovery-tries = 1
score-cap = .6
heal-enabled = true
serverHost = localhost
Expand Down

0 comments on commit e52aca2

Please sign in to comment.