Make Widget implement WebElement
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
Description
Since Widget does not implement WebElement along with WrapsElement, it makes calls to the WebElement methods require a verbose call to getWrappedElement every time an interaction is needed. It would be a simple fix to have Widget implement this interface and delegate to the underlying element.
Environment
n/a
Details
I tried to extend Widget and implement WebElement in the subclass, but there's a type-erasure issue because of the implementation of findElement(By By)
Code To Reproduce Issue [ Good To Have ]
public Class MyWidget extends Widget implements WebElement {
// WebElement interface requires a generic here, but Widget does not
@Override
public <T extends WebElement> T findElement(By by) {
return element.findElement(by);
}
}
Ecxeption stacktraces
Error:(65, 43) java: name clash: findElement(org.openqa.selenium.By) in MyWidget and findElement(org.openqa.selenium.By) in io.appium.java_client.pagefactory.Widget have the same erasure, yet neither overrides the other
Link to Appium logs
n/a
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Widget entry point, its findElement(By) method, and getWrappedElement; compare their signatures with WebElement and the reproduction shown in the issue. Done means Widget can be used as a WebElement without the reported type-erasure error, with delegated interactions covered by the relevant existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100