You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
new HashSet<>(listOfWebElements) is empty for non-empty list of elements when using Appium client 9.0.0 with page factory
Environment
Java client build version: 9.0.0
Appium server version: 2.2.0
Desktop OS/version used to run Appium: MacOS 14.0 (23A344)
Node.js version: v18.16.1
Mobile platform/version under test: Android API34
Real device or emulator/simulator: emulator
Java version: java 17.0.7 2023-04-18 LTS
Maven version: 4.0.0-alpha-5
Details
new HashSet<>(listOfWebElements) is empty for valid non-empty list when using Appium client 9.0.0.
This worked with client 8.6.0, but with 9.0.0 the set is empty.
Test asserting that size of set is equal to size of list passes with client 8.6.0, but fails with 9.0.0.
Code To Reproduce Issue [ Good To Have ]
git@github.com:AndriyShykin/TheAppTests.git repository with single test that fails with client 9.0.0, but passes with 8.6.0.
Base page object class:
package screens;
imports...
public abstract class BaseScreen {
private final AppiumDriver driver;
private final WebDriverWait wait;
Description
new HashSet<>(listOfWebElements) is empty for non-empty list of elements when using Appium client 9.0.0 with page factory
Environment
Details
new HashSet<>(listOfWebElements) is empty for valid non-empty list when using Appium client 9.0.0.
This worked with client 8.6.0, but with 9.0.0 the set is empty.
Test asserting that size of set is equal to size of list passes with client 8.6.0, but fails with 9.0.0.
Code To Reproduce Issue [ Good To Have ]
git@github.com:AndriyShykin/TheAppTests.git repository with single test that fails with client 9.0.0, but passes with 8.6.0.
Base page object class:
package screens;
imports...
public abstract class BaseScreen {
private final AppiumDriver driver;
private final WebDriverWait wait;
protected BaseScreen(AppiumDriver driver) {
this.driver = driver;
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
wait = new WebDriverWait(driver, Duration.ofSeconds(10), Duration.ofSeconds(1));
}
protected void click(final WebElement element) {
wait.until(ExpectedConditions.elementToBeClickable(element)).click();
}
}
Page object class:
package screens;
imports...
public class ListScreen extends BaseScreen {
@AndroidFindBy(xpath = "//android.view.ViewGroup[@resource-id='RNE__LISTITEM__padView']")
private List listItems;
public ListScreen(AppiumDriver driver) {
super(driver);
}
public int getListSize() {
return listItems.size();
}
public int getSetSize() {
return new HashSet<>(listItems).size();
}
}
Base test:
package ui;
imports...
public abstract class BaseTest {
private AppiumDriver driver;
private AndroidDriver androidSetup() throws MalformedURLException {
final UiAutomator2Options options = new UiAutomator2Options()
.clearDeviceLogsOnStart()
.disableWindowAnimation()
.setApp("https://github.com/appium-pro/TheApp/releases/download/v1.12.0/TheApp.apk")
.setAppWaitPackage("com.appiumpro.the_app")
.setAutoGrantPermissions(true)
.setUdid("emulator-5554");
return new AndroidDriver(new URL("http://127.0.0.1:1234"), options);
}
@beforeeach
protected void setup() throws MalformedURLException {
driver = androidSetup();
}
@AfterEach
protected void teardown() {
if (getDriver() != null) {
((InteractsWithApps) getDriver()).terminateApp("com.appiumpro.the_app");
getDriver().quit();
}
}
private AppiumDriver getDriver() {
return driver;
}
protected HomeScreen getHomeScreen() {
return new HomeScreen(getDriver());
}
protected ListScreen getListScreen() {
return new ListScreen(getDriver());
}
}
Test class with test that passes with client 8.6.0 but fails with client 9.0.0:
package ui;
imports...
final class ListTests extends BaseTest {
@test
void listSetSizeTest() {
getHomeScreen().clickListDemo();
int listSize = getListScreen().getListSize();
int setSize = getListScreen().getSetSize();
Assertions.assertEquals(setSize, listSize);
}
}
Exception Stacktraces
no exception is thrown
Link To Appium Logs
https://gist.github.com/AndriyShykin/6aeee430eed0282670ecce86d47653b8
The text was updated successfully, but these errors were encountered: