Skip to content

Adopt changes from https://github.com/SeleniumHQ/selenium/issues/15884 #11

Description

@AB-xdev

Checklist

  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise.
  • This issue contains only one feature request/enhancement.

Description

In SeleniumHQ/selenium#15884 I made some Selenium APIs protected this way we no longer require reflection to do modifications.

Reflection can therefore likely be removed in

public static class CustomizableJsonToWebElementConverter extends JsonToWebElementConverter
{
// Can be removed once https://github.com/SeleniumHQ/selenium/issues/15884 is fixed
private final Method mSetOwner;
private final Supplier<RemoteWebElement> remoteWebElementSupplier;
public CustomizableJsonToWebElementConverter(
final RemoteWebDriver driver,
final Supplier<RemoteWebElement> remoteWebElementSupplier)
{
super(driver);
try
{
this.mSetOwner = JsonToWebElementConverter.class.getDeclaredMethod("setOwner", RemoteWebElement.class);
this.mSetOwner.setAccessible(true);
}
catch(final NoSuchMethodException ex)
{
throw new IllegalStateException("Failed to find setOwner", ex);
}
this.remoteWebElementSupplier = remoteWebElementSupplier;
}
@Override
protected RemoteWebElement newRemoteWebElement()
{
try
{
return (RemoteWebElement)this.mSetOwner.invoke(this, this.remoteWebElementSupplier.get());
}
catch(final IllegalAccessException | InvocationTargetException e)
{
throw new IllegalStateException("Failed to call setOwner", e);
}
}
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions