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

Selenium 4 and Appium 2 Upgrade #360

Merged
merged 47 commits into from
Jun 24, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
32a3ff3
(feat): Selenium 4 upgrade part 1
gayathri-testsigma Mar 7, 2023
03a43b6
TRD-217_upgrade
vikramvr20 Mar 7, 2023
b03c05d
Merge remote-tracking branch 'origin/TRD-217_upgrade' into selenium4
gayathri-testsigma Mar 7, 2023
db730c9
(feat): merge conflicts
gayathri-testsigma Mar 7, 2023
9c3ad06
Made changes wrt to appium java client 8
vikramvr20 Mar 7, 2023
defc58f
(feat): dependency updates
gayathri-testsigma Mar 14, 2023
a234597
fix merging capabailities
gayathri-testsigma Mar 14, 2023
7ad4771
(feat): selenium fixes
gayathri-testsigma Mar 21, 2023
2ab5966
feat: selenium 4 latest dependency
gayathri-testsigma Apr 5, 2023
61195a3
selenium 4 minor changes
gayathri-testsigma Apr 5, 2023
a07855f
Merge branch 'dev' into selenium4
gayathri-testsigma Apr 5, 2023
6482009
TRD-217
vikramvr20 Apr 24, 2023
ee23069
feat(Se4): fixes
gayathri-testsigma Apr 26, 2023
99552e1
TRD-217
vikramvr20 May 2, 2023
19eab55
fix(se4): remove hardcoded desired capability
gayathri-testsigma May 3, 2023
9f573a4
Merge branch 'selenium4' of https://github.com/testsigmahq/testsigma …
gayathri-testsigma May 3, 2023
c06fd97
fix(se4): address review comment
gayathri-testsigma May 4, 2023
09f1b45
TRD-217
vikramvr20 May 8, 2023
083eb0a
TRD-217
vikramvr20 May 8, 2023
bec7769
TRD-217
vikramvr20 May 9, 2023
942ae33
TRD-217
vikramvr20 May 16, 2023
a91f012
TRD-217
vikramvr20 May 16, 2023
052178a
TRD-217
vikramvr20 May 16, 2023
7aaf834
TRD-217
vikramvr20 May 18, 2023
4e52ce4
TRD-217
vikramvr20 May 19, 2023
6223dc4
TRD-217
vikramvr20 May 22, 2023
8be562e
TRD-217
vikramvr20 May 22, 2023
7f83678
TRD-217
vikramvr20 May 22, 2023
ca66b72
TRD-217
vikramvr20 May 23, 2023
e3883f6
(feat): private grid + se4 features
gayathri-testsigma May 25, 2023
334a08a
(feat): grid fixes
gayathri-testsigma May 26, 2023
42b88e0
fixes for grid
gayathri-testsigma May 26, 2023
ab37e02
(feat): Element level screenshot
gayathri-testsigma May 29, 2023
8c0dd8d
(feat): Driver Manager
gayathri-testsigma Jun 2, 2023
62dcbdd
TRD-217
vikramvr20 Jun 6, 2023
47a9d84
bug: name for edge browser is changed in grid4
gayathri-testsigma Jun 8, 2023
9779297
TRD-217
vikramvr20 Jun 9, 2023
6146b41
TRD-217
vikramvr20 Jun 13, 2023
374a7a1
TRD-217
vikramvr20 Jun 13, 2023
b1b94f6
chore: remove unused imports
gayathri-testsigma Jun 13, 2023
349fd98
Merge branch 'selenium4' of https://github.com/testsigmahq/testsigma …
gayathri-testsigma Jun 13, 2023
e8967b4
Merge branch 'dev' into selenium4
gayathri-testsigma Jun 13, 2023
d8ba1e4
chore: remove unused imports
gayathri-testsigma Jun 13, 2023
0732973
chore: code style fixes
gayathri-testsigma Jun 13, 2023
634f468
TRD-217
vikramvr20 Jun 13, 2023
bbe930a
Merge branch 'selenium4' of https://github.com/testsigmahq/testsigma …
vikramvr20 Jun 13, 2023
50889d9
bug: name key in desiredcap for local run
gayathri-testsigma Jun 13, 2023
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
2 changes: 1 addition & 1 deletion agent-launcher/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</plugins>
</build>
<properties>
<lombok.version>1.18.10</lombok.version>
<lombok.version>1.18.22</lombok.version>
<systemtray.version>3.17</systemtray.version>
<maven.compiler.plugin>3.8.1</maven.compiler.plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion agent-launcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<maven.compiler.plugin>3.8.1</maven.compiler.plugin>
<commons.lang.version>3.4</commons.lang.version>
<systemtray.version>3.17</systemtray.version>
<lombok.version>1.18.10</lombok.version>
<lombok.version>1.18.22</lombok.version>
<httpcomponents.version>4.5.13</httpcomponents.version>
</properties>

Expand Down
10 changes: 9 additions & 1 deletion agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.plugin>3.8.1</maven.compiler.plugin>
<lombok.version>1.18.20</lombok.version>
<selenium.version>4.8.2</selenium.version>
<guava.version>31.1-jre</guava.version>
<lombok.version>1.18.22</lombok.version>
<mapstruct.version>1.4.2.Final</mapstruct.version>
<aws.version>1.11.46</aws.version>
<android.tools.version>25.3.0</android.tools.version>
Expand Down Expand Up @@ -139,6 +141,12 @@
<groupId>com.android.tools.ddms</groupId>
<artifactId>ddmlib</artifactId>
<version>${android.tools.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@Log4j2
public class TestsigmaAgent {
public static void main(String[] args) {
System.setProperty("webdriver.http.factory", "jdk-http-client");
String wrapperPort = System.getProperty("agent.wrapper.port");
if (StringUtils.isNotBlank(wrapperPort)) {
WrapperConnector.getInstance().disconnectHook();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

import com.testsigma.agent.utils.NetworkUtil;
import com.testsigma.agent.utils.PathUtil;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.SystemUtils;
Expand All @@ -29,6 +32,8 @@ public class MobileAutomationServer {
private Process mobileAutomationServerProcess;
private File androidHome;
private File jreHome;

private File appiumHome;
private File mobileAutomationServerExecutablePath;
private File logFilePath;
private String serverIpAddress;
Expand All @@ -46,6 +51,10 @@ private File jreHome() {
return new File(PathUtil.getInstance().getJrePath());
}

private File appiumHome(){
return new File(PathUtil.getInstance().getMobileAutomationDriverPath());
}

private String serverIP() {
String address = "127.0.0.1";
try {
Expand All @@ -64,14 +73,15 @@ public void start() {
}
this.androidHome = androidHome();
this.jreHome = jreHome();
this.appiumHome = appiumHome();
this.mobileAutomationServerExecutablePath = new File(PathUtil.getInstance().getMobileAutomationServerPath(), "appium");
if (SystemUtils.IS_OS_WINDOWS) {
this.mobileAutomationServerExecutablePath = new File(PathUtil.getInstance().getMobileAutomationServerPath(), "appium.exe");
}
this.serverIpAddress = serverIP();
this.logFilePath = new File(PathUtil.getInstance().getLogsPath() + File.separator + "appium.log");
Integer serverPort = NetworkUtil.getFreePort();
this.serverURL = String.format("http://%s:%d/wd/hub", serverIpAddress, serverPort);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikramvr20 we need to have Appium server also need to upgraded. jfyi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vikramvr20 Please confirm and do necessary changes..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PratheepV - Yes that's already been done and discussed the approach with Rajesh and Vikram.

this.serverURL = String.format("http://%s:%d", serverIpAddress, serverPort);

log.info("Starting Mobile Automation Server at - " + serverURL);

Expand All @@ -87,6 +97,7 @@ public void start() {
"--log-timestamp",
"--allow-insecure", "chromedriver_autodownload");
processBuilder.directory(new File(PathUtil.getInstance().getMobileAutomationServerPath()));
processBuilder.environment().put("APPIUM_HOME", appiumHome.getAbsolutePath());
processBuilder.environment().put("ANDROID_HOME", androidHome.getAbsolutePath());
processBuilder.environment().put("JAVA_HOME", jreHome.getAbsolutePath());
processBuilder.redirectErrorStream(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class AndroidMobileAutomationServer {
private final DeviceContainer deviceContainer;
private final CommandExecutor commandExecutor;

private final String UI_AUTOMATOR2_SERVER_TEST_APK = "appium-uiautomator2-server-test.apk";
private final String UI_AUTOMATOR2_SERVER_APK = "appium-uiautomator2-server.apk";
private final String UI_AUTOMATOR2_SERVER_TEST_APK = "appium-uiautomator2-server-debug-androidTest.apk";
private final String UI_AUTOMATOR2_SERVER_APK = "appium-uiautomator2-server-v5.8.2.apk";
private final String APPIUM_SETTINGS_APK = "settings_apk-debug.apk";
private final String UI_AUTOMATOR2_PACKAGE = "io.appium.uiautomator2.server";
private final String UI_AUTOMATOR2_TEST_PACKAGE = "io.appium.uiautomator2.server.test";
Expand All @@ -38,7 +38,6 @@ public void installDrivers(String uniqueId) throws MobileLibraryInstallException
try {
MobileDevice mobileDevice = deviceContainer.getDevice(uniqueId);
IDevice device = mobileDevice.getIDevice();

this.installAppiumSettings(device);
this.startAppiumSettings(device);
this.installUIAutomatorServer(device);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.testsigma.agent.mobile.MobileAutomationServerService;
import com.testsigma.agent.mobile.DeviceContainer;
import com.testsigma.agent.mobile.MobileDevice;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -58,7 +59,7 @@ public void createSession(String uniqueId) throws MobileAutomationServerSessionE
desiredCapabilities.setCapability("xcodeOrgId", "6F4CKCA4LX");
desiredCapabilities.setCapability("xcodeSigningId", "iPhone Developer");
desiredCapabilities.setCapability("app", "/Users/vikram/ios-apps/ios-test-app/build/Release-iphoneos/TestApp-iphoneos.app");
device.setRemoteWebDriver(new IOSDriver<>(new URL(mobileAutomationServerService.getMobileAutomationServer().getServerURL()),
device.setRemoteWebDriver(new IOSDriver(new URL(mobileAutomationServerService.getMobileAutomationServer().getServerURL()),
desiredCapabilities));
} catch (Exception e) {
throw new MobileAutomationServerSessionException(e.getMessage());
Expand Down
4 changes: 4 additions & 0 deletions agent/src/main/java/com/testsigma/agent/utils/PathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class PathUtil {
private String iosPath = null;
@Getter
private String mobileAutomationServerPath = null;

@Getter
private String mobileAutomationDriverPath = null;
@Getter
private String upgradePath = null;
@Getter
Expand Down Expand Up @@ -79,6 +82,7 @@ public void setPathsFromContext(boolean reset) {
driversPath = rootPath + File.separator + "drivers";
jrePath = rootPath + File.separator + "jre";
mobileAutomationServerPath = rootPath + File.separator + "appium";
mobileAutomationDriverPath = mobileAutomationServerPath + "/drivers";
androidPath = rootPath + File.separator + "android";
iosPath = rootPath + File.separator + "ios";

Expand Down
2 changes: 1 addition & 1 deletion agent/src/main/resources/agent.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
cloud.url=${CLOUD_URL:https://local.testsigmaos.com}
local.server.url=${LOCAL_SERVER_URL:http://localhost:9090}
local.agent.register=${LOCAL_AGENT_REGISTER:true}
agent.version=2.9.1
agent.version=2.9.2
24 changes: 21 additions & 3 deletions automator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<skyscreamer.version>1.5.0</skyscreamer.version>
<jsonpath.version>2.2.0</jsonpath.version>
<gson.version>2.8.5</gson.version>
<appium.version>7.0.0</appium.version>
<selenium.version>3.141.59</selenium.version>
<selenium.version>4.8.2</selenium.version>
<appium.version>8.3.0</appium.version>
<jetty-io.version>9.4.12.v20180830</jetty-io.version>
<commons.collections.version>4.4</commons.collections.version>
<org.everit.json.schema>1.5.1</org.everit.json.schema>
Expand Down Expand Up @@ -83,6 +83,12 @@

</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-http-jdk-client</artifactId>
<version>${selenium.version}</version>
</dependency>

<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -139,6 +145,12 @@
<groupId>org.everit.json</groupId>
<artifactId>org.everit.json.schema</artifactId>
<version>${org.everit.json.schema}</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -284,7 +296,7 @@
<dependency>
<groupId>com.testsigma</groupId>
<artifactId>testsigma-java-sdk</artifactId>
<version>1.0.0.rc1</version>
<version>1.2.0_beta_1</version>
</dependency>

<dependency>
Expand All @@ -298,6 +310,12 @@
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this in automator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting the below error without adding the dependency. Hence added the same.

Screenshot 2023-05-16 at 2 27 43 PM

<artifactId>spring-context</artifactId>
<version>5.3.20</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
3 changes: 2 additions & 1 deletion automator/src/com/testsigma/automator/actions/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.openqa.selenium.*;
import org.openqa.selenium.remote.UnreachableBrowserException;

import java.time.Duration;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -35,7 +36,7 @@ public abstract class Action {
private static final int MESSAGE_MAX_SIZE = 500;
protected Exception exception;
protected Object actualValue;
protected Long timeout = 30L;
protected Duration timeout = Duration.ofSeconds(30);
protected ErrorCodes errorCode = ErrorCodes.GENERIC_ERROR;
protected Long globalElementTimeOut;
protected Map<String, TestDataPropertiesEntity> testDataPropertiesEntityMap;
Expand Down
13 changes: 1 addition & 12 deletions automator/src/com/testsigma/automator/actions/AddonAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ private void handleStaleElementExceptionType(Exception e) {
}

private void handleInvalidStateExceptionType(Exception e) {
if (e instanceof ElementNotVisibleException) {
if (e instanceof ElementNotInteractableException) {
gayathri-testsigma marked this conversation as resolved.
Show resolved Hide resolved
String errorMessage;
if (getElementSearchCriteria()) {
errorMessage = String.format("Element may be present but not visible in current page. Please verify if the " +
Expand All @@ -406,17 +406,6 @@ private void handleInvalidStateExceptionType(Exception e) {
"If the element is not in view, please try executing step <b>\"Scroll to the element ELEMENT into view\"</b></b>";
setErrorMessage(errorMessage);
setErrorCode(ErrorCodes.ELEMENT_CLICK_INTERCEPTED_EXCEPTION);
} else if (e instanceof ElementNotSelectableException) {
gayathri-testsigma marked this conversation as resolved.
Show resolved Hide resolved
String errorMessage;
if (getElementSearchCriteria()) {
errorMessage = String.format("Element is present but it is not selectable. Please check if the select element " +
"corresponding to locator <b>\"%s:%s\"</b> is enabled and interactable.",
elementPropertiesEntity.getFindByType(), elementPropertiesEntity.getLocatorValue());
} else {
errorMessage = "Element is present but it is not selectable. Please verify if the select element for given criteria is enabled and selectable.";
}
setErrorMessage(errorMessage);
setErrorCode(ErrorCodes.ELEMENT_NOT_SELECTABLE_EXCEPTION);
} else {
String errorMessage = "Cannot perform any action on the element. Though element may be present, it is in a non-interactive state.";
setErrorMessage(errorMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -204,7 +205,7 @@ final static public void explictWait(WebDriver driver, By by, Integer wait) {
return;
}
if (by != null) {
(new WebDriverWait(driver, wait)).until(ExpectedConditions.presenceOfElementLocated(by));
(new WebDriverWait(driver, Duration.ofSeconds(wait))).until(ExpectedConditions.presenceOfElementLocated(by));
}
}
}
12 changes: 7 additions & 5 deletions automator/src/com/testsigma/automator/actions/DriverAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

@Log4j2
Expand Down Expand Up @@ -49,19 +50,20 @@ protected void afterExecute() throws AutomatorException {

private void setImplicitTimeout() {
if (getGlobalElementTimeOut() != null && !getTimeout().equals(getGlobalElementTimeOut())) {
log.info("Updating implicit timeout to step level timeout:" + getTimeout());
log.info("Updating implicit timeout to step level timeout:" + getTimeout().getSeconds());
setDriverImplicitTimeout(getTimeout());
}
}

protected void setDriverImplicitTimeout(long timeInSeconds) {
getDriver().manage().timeouts().implicitlyWait(timeInSeconds, TimeUnit.SECONDS);
protected void setDriverImplicitTimeout(Duration timeInSeconds) {
getDriver().manage().timeouts().implicitlyWait(timeInSeconds);
}

private void resetImplicitTimeout() {
if (getGlobalElementTimeOut() != null && getTimeout() != getGlobalElementTimeOut()) {
if (getGlobalElementTimeOut() != null && getTimeout().getSeconds() != getGlobalElementTimeOut()) {
log.info("Resetting implicit timeout to Test plan level timeout:" + getGlobalElementTimeOut());
setDriverImplicitTimeout(getGlobalElementTimeOut());
setDriverImplicitTimeout(Duration.ofSeconds(getGlobalElementTimeOut()));
}
}

}
19 changes: 5 additions & 14 deletions automator/src/com/testsigma/automator/actions/ElementAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.openqa.selenium.support.ui.UnexpectedTagNameException;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -62,7 +63,7 @@ protected void findElement(String elementActionVariableName) throws Exception {
log.info("Finding an element for Action variable: " + elementActionVariableName);
setElementSearchCriteria(elementActionVariableName);
log.info(String.format("Finding element with criteria: %s, Explicit timeout as: %s", elementSearchCriteria, getTimeout()));
CustomExpectedConditions.explictWait(getDriver(), elementSearchCriteria.getBy(), getTimeout().intValue());
CustomExpectedConditions.explictWait(getDriver(), elementSearchCriteria.getBy(), (int)getTimeout().getSeconds());
elements = getDriver().findElements(elementSearchCriteria.getBy());
log.info("No of elements found: " + elements.size());
if (!elements.isEmpty()) {
Expand Down Expand Up @@ -267,13 +268,13 @@ private void handleStaleElementExceptionType(Exception e) {
}

private void handleInvalidStateExceptionType(Exception e) {
if (e instanceof ElementNotVisibleException) {
if (e instanceof ElementNotInteractableException) {
String errorMessage;
if (elementSearchCriteria != null) {
errorMessage = String.format("Element may be present but not visible in current page. Please verify if the " +
errorMessage = String.format("Element may be present but not interactable in current page. Please verify if the " +
"element <b>\"%s:%s\"</b> is pointing to a displayed element.", elementSearchCriteria.getFindByType(), elementSearchCriteria.getByValue());
} else {
errorMessage = "Element may be present but not visible in current page. Please verify the given element criteria is pointing to a displayed/visible element.";
errorMessage = "Element may be present but not interactable in current page. Please verify the given element criteria is pointing to a displayed/visible element.";
}
setErrorMessage(errorMessage);
setErrorCode(ErrorCodes.ELEMENT_NOT_VISIBLE);
Expand All @@ -283,16 +284,6 @@ private void handleInvalidStateExceptionType(Exception e) {
"If the element is not in view, please try executing step <b>\"Scroll to the element ELEMENT into view\"</b></b>";
setErrorMessage(errorMessage);
setErrorCode(ErrorCodes.ELEMENT_CLICK_INTERCEPTED_EXCEPTION);
} else if (e instanceof ElementNotSelectableException) {
gayathri-testsigma marked this conversation as resolved.
Show resolved Hide resolved
String errorMessage;
if (elementSearchCriteria != null) {
errorMessage = String.format("Element is present but it is not selectable. Please check if the select element " +
"corresponding to locator <b>\"%s:%s\"</b> is enabled and interactable.", elementSearchCriteria.getFindByType(), elementSearchCriteria.getByValue());
} else {
errorMessage = "Element is present but it is not selectable. Please verify if the select element for given criteria is enabled and selectable.";
}
setErrorMessage(errorMessage);
setErrorCode(ErrorCodes.ELEMENT_NOT_SELECTABLE_EXCEPTION);
} else {
String errorMessage = "Cannot perform any action on the element. Though element may be present, it is in a non-interactive state.";
setErrorMessage(errorMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ClearElementAction extends MobileElementAction {
public void execute() throws Exception {
AppiumDriver driver = getDriver();
findElement();
if (driver.getContextHandles().size() > 1) {
if (getContextHandles().size() > 1) {
tapByElementCoOrdinates(getElement(), driver);
}
getElement().clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public void execute() throws Exception {
AppiumDriver driver = getDriver();
List<WebElement> webElements = new ArrayList<WebElement>();
if (getWebViewName() != null && !getWebViewName().equals("null")) {
driver.context(getWebViewName());
context(getWebViewName());
webElements = driver.findElements(getElementSearchCriteria().getBy());
webElements.get(getIndex()).clear();
driver.context("NATIVE_APP");
} else if (driver.getContextHandles().size() > 1) {
context("NATIVE_APP");
} else if (getContextHandles().size() > 1) {
webElements = driver.findElements(getElementSearchCriteria().getBy());
tapByElementCoOrdinates(webElements.get(getIndex()), driver);
webElements.get(getIndex()).clear();
Expand Down
Loading