0
List<WebElement> count=  driver.findElements(by.xpath("abc"));

I am getting an error if I use the above line:

"Type safety: The expression of type List needs unchecked conversion to conform to List<WebElement>"

I am doing a TestProject coded android test

Shirley P
  • 3
  • 1
Lipson T A
  • 49
  • 3
  • 9

1 Answers1

0

If you check findElements method in source code:

    @Override public List<T> findElements(By by) {
        return super.findElements(by);
    }

The T is a type parameter passed to the generic interface List. In order to use it, you must define the type in your code:

List<MobileElement> count = driver.findElements(by.xpath("abc"));
dmle
  • 3,498
  • 1
  • 14
  • 22