Skip to content

Commit aa6e2ba

Browse files
authored
Process element highlight correctly (#137)
fixes #128
1 parent 9751590 commit aa6e2ba

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/main/java/aquality/selenium/elements/Element.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public String getText() {
131131
@Override
132132
public String getText(HighlightState highlightState) {
133133
logElementAction("loc.get.text");
134-
getJsActions().highlightElement();
134+
getJsActions().highlightElement(highlightState);
135135
String value = doWithRetry(() -> getElement().getText());
136136
logElementAction("loc.text.value", value);
137137
return value;
@@ -147,7 +147,7 @@ public IElementStateProvider state() {
147147
@Override
148148
public String getAttribute(final String attr, HighlightState highlightState) {
149149
logElementAction("loc.el.getattr", attr);
150-
getJsActions().highlightElement();
150+
getJsActions().highlightElement(highlightState);
151151
String value = doWithRetry(() -> getElement().getAttribute(attr));
152152
logElementAction("loc.el.attr.value", attr, value);
153153
return value;
@@ -156,7 +156,7 @@ public String getAttribute(final String attr, HighlightState highlightState) {
156156
@Override
157157
public String getCssValue(final String propertyName, HighlightState highlightState) {
158158
logElementAction("loc.el.cssvalue", propertyName);
159-
getJsActions().highlightElement();
159+
getJsActions().highlightElement(highlightState);
160160
String value = doWithRetry(() -> getElement().getCssValue(propertyName));
161161
logElementAction("loc.el.attr.value", propertyName, value);
162162
return value;

src/main/java/aquality/selenium/elements/actions/JsActions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public void highlightElement() {
7171
* Highlights the element.
7272
*/
7373
public void highlightElement(HighlightState highlightState) {
74-
if (AqualityServices.getBrowserProfile().isElementHighlightEnabled() || highlightState.equals(HighlightState.HIGHLIGHT)) {
74+
if ((AqualityServices.getBrowserProfile().isElementHighlightEnabled() && !highlightState.equals(HighlightState.NOT_HIGHLIGHT))
75+
|| highlightState.equals(HighlightState.HIGHLIGHT)) {
7576
executeScript(JavaScript.BORDER_ELEMENT);
7677
}
7778
}

src/test/java/tests/usecases/BrowserConcurrencyTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void testShouldBePossibleToUseParallelStreams(){
4040
textBoxes.parallelStream().forEach(lbl -> {
4141
// set the same instance of browser for all threads
4242
AqualityServices.setBrowser(browser);
43-
String text = lbl.getText(HighlightState.HIGHLIGHT);
43+
String text = lbl.getText(HighlightState.NOT_HIGHLIGHT);
4444
// processing results of work trough web driver (getting text)
4545
String updatedText = text + "_updated";
4646
texts.add(text);

0 commit comments

Comments
 (0)