Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight elements correctly #137

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading