Convert RemoteWebElements decoded from JSON to "known elements".
As of commit the decoded JSON parameters may include a WebElement. It's necessary to convert the element when a RemoteWebElement is passed as the "id" param to SwitchToFrame.
Fixes
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import org.openqa.selenium.remote.RemoteWebElement;
import org.openqa.selenium.remote.server.KnownElements;
import java.util.List;
@@ -51,6 +52,10 @@ public Object apply(Object arg) {
return converted;
}
+ if (arg instanceof RemoteWebElement) {
+ return knownElements.get(((RemoteWebElement) arg).getId());
+ }
+
if (arg instanceof List<?>) {
return Lists.newArrayList(Iterables.transform((List<?>) arg, this));
}
