yandex-qatools / htmlelements

Html Elements is a Java framework providing easy-to-use way of interaction with web-page elements in web-page tests.
Other
271 stars 116 forks source link

TypifiedElement implementing WebElement? #120

Closed ham1 closed 8 years ago

ham1 commented 8 years ago

Is there a reason that TypifiedElement doesn't implement WebElement?

The main reason for asking is to simplify use of ExpectedConditions, especially when using a list of them e.g. List<CheckBox> checkboxes.

I'd like to do: wait.until(ExpectedConditions.visibilityOfAllElements(checkboxes)) but because visibilityOfAllElements only accepts List<WebElement> this doesn't work, equally for visibilityOf having to add .getWrappedElement() isn't ideal.

Also, as the PageFactory replaces them with lazy proxies if trying to convert that into a list of WebElements to wait for, I'm not sure the following would work?

checkboxes.stream()
          .map(WrappedElement::getWrappedElement)
          .collect(toList());

Or is there something I've missed?

ham1 commented 8 years ago

I've created a PR which solved the visibilityOf(checkBox) problem from an interface point of view.

However Lists are more complex. When doing

// wait has timeout of 10s
wait.until(visibilityOfAllElements(checkBoxes.stream()
        .map(te -> (WebElement) te)
        // same behaviour with
        //.map(TypifiedElement::getWrappedElement)
        .collect(toList())))

It fails after 5s (the implicit wait as mentioned in #111) - is there a way, without using the @Timeout everywhere, to utilise the explicit wait for lists?