Skip to content

Commit

Permalink
[Bug] Process element highlight correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mialeska committed Feb 23, 2024
1 parent 9751590 commit 42d43dc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/aquality/selenium/elements/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public String getText() {
@Override
public String getText(HighlightState highlightState) {
logElementAction("loc.get.text");
getJsActions().highlightElement();
getJsActions().highlightElement(highlightState);
String value = doWithRetry(() -> getElement().getText());
logElementAction("loc.text.value", value);
return value;
Expand All @@ -147,7 +147,7 @@ public IElementStateProvider state() {
@Override
public String getAttribute(final String attr, HighlightState highlightState) {
logElementAction("loc.el.getattr", attr);
getJsActions().highlightElement();
getJsActions().highlightElement(highlightState);
String value = doWithRetry(() -> getElement().getAttribute(attr));
logElementAction("loc.el.attr.value", attr, value);
return value;
Expand All @@ -156,7 +156,7 @@ public String getAttribute(final String attr, HighlightState highlightState) {
@Override
public String getCssValue(final String propertyName, HighlightState highlightState) {
logElementAction("loc.el.cssvalue", propertyName);
getJsActions().highlightElement();
getJsActions().highlightElement(highlightState);
String value = doWithRetry(() -> getElement().getCssValue(propertyName));
logElementAction("loc.el.attr.value", propertyName, value);
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void highlightElement() {
* Highlights the element.
*/
public void highlightElement(HighlightState highlightState) {
if (AqualityServices.getBrowserProfile().isElementHighlightEnabled() || highlightState.equals(HighlightState.HIGHLIGHT)) {
if ((AqualityServices.getBrowserProfile().isElementHighlightEnabled() && !highlightState.equals(HighlightState.NOT_HIGHLIGHT))
|| highlightState.equals(HighlightState.HIGHLIGHT)) {
executeScript(JavaScript.BORDER_ELEMENT);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/tests/usecases/BrowserConcurrencyTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testShouldBePossibleToUseParallelStreams(){
textBoxes.parallelStream().forEach(lbl -> {
// set the same instance of browser for all threads
AqualityServices.setBrowser(browser);
String text = lbl.getText(HighlightState.HIGHLIGHT);
String text = lbl.getText(HighlightState.NOT_HIGHLIGHT);
// processing results of work trough web driver (getting text)
String updatedText = text + "_updated";
texts.add(text);
Expand Down

0 comments on commit 42d43dc

Please sign in to comment.