Skip to content

Commit

Permalink
Convert RemoteWebElements decoded from JSON to "known elements".
Browse files Browse the repository at this point in the history
As of commit e32b83d, 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 SeleniumHQ#4083.
  • Loading branch information
juangj committed May 26, 2017
1 parent 402f65d commit d71a8b1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit d71a8b1

Please sign in to comment.