Skip to content

Commit

Permalink
Removed custom type method
Browse files Browse the repository at this point in the history
  • Loading branch information
martingrossmann committed Aug 15, 2024
1 parent c87ad5d commit b093d05
Showing 1 changed file with 0 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import eu.tsystems.mms.tic.testframework.utils.AppiumUtils;
import eu.tsystems.mms.tic.testframework.utils.ExecutionUtils;
import io.appium.java_client.AppiumDriver;
import org.apache.commons.lang3.NotImplementedException;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -172,45 +171,7 @@ public boolean isSelected() {
@Override
@Deprecated
public boolean isSelectable() {

throw new MobileActionNotSupportedException("isSelectable() is not supported on mobile elements");
}

/**
* Appium on apps does not support webElement.getAttribute("value"), but webElement.getText() is working
*/
@Override
public void type(String text) {
if (text == null) {
log().warn("Text to type is null. Typing nothing.");
return;
}
if (text.isEmpty()) {
log().warn("Text to type is empty!");
}

findWebElement(webElement -> {
webElement.clear();
webElement.sendKeys(text);

// String valueProperty = webElement.getAttribute("value");
String valueProperty = webElement.getText();
if (valueProperty != null) {
if (!valueProperty.equals(text)) {
log().warn("Writing text to input field didn't work. Trying again.");

webElement.clear();
webElement.sendKeys(text);

// if (!webElement.getAttribute("value").equals(text)) {
if (!webElement.getText().equals(text)) {
log().error("Writing text to input field didn't work on second try!");
}
}
} else {
log().warn("Cannot perform value check after type() because " + this.toString() +
" doesn't have a value property. Consider using sendKeys() instead.");
}
});
}
}

0 comments on commit b093d05

Please sign in to comment.