Skip to content

Commit 6654610

Browse files
committed
java: Implementing ability to switch to a frame by WebElement in marionette
1 parent 40377e4 commit 6654610

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Diff for: java/client/src/org/openqa/selenium/firefox/internal/MarionetteConnection.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.openqa.selenium.Beta;
2525
import org.openqa.selenium.WebDriverException;
26+
import org.openqa.selenium.WebElement;
2627
import org.openqa.selenium.firefox.ExtensionConnection;
2728
import org.openqa.selenium.firefox.FirefoxBinary;
2829
import org.openqa.selenium.firefox.FirefoxProfile;
@@ -295,6 +296,13 @@ private String serializeCommand(Command command) {
295296

296297
} else if (DriverCommand.SET_ALERT_VALUE.equals(commandName)) {
297298
renameParameter(params, "text", "value");
299+
300+
} else if (DriverCommand.SWITCH_TO_FRAME.equals(commandName)) {
301+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1143908
302+
if (params.get("id") instanceof Map) {
303+
params.put("element", ((Map<String, Object>) params.get("id")).get("ELEMENT"));
304+
params.remove("id");
305+
}
298306
}
299307

300308
if (seleniumToMarionetteCommandMap.containsKey(commandName)) {
@@ -305,7 +313,6 @@ private String serializeCommand(Command command) {
305313
map.put("to", marionetteId != null ? marionetteId : "root");
306314
map.put("name", commandName);
307315
if (command.getSessionId() != null) {
308-
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1073732
309316
map.put("sessionId", command.getSessionId().toString());
310317
}
311318
map.put("parameters", params);

Diff for: java/client/test/org/openqa/selenium/FrameSwitchingTest.java

-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public void testShouldNotAutomaticallySwitchFocusToAnIFrameWhenAPageContainingTh
7474

7575
@Test(timeout = 10000)
7676
@NeedsLocalEnvironment(reason = "it hangs at IE9 and event Test.timeout doesn't help")
77-
@Ignore(MARIONETTE)
7877
public void testShouldOpenPageWithBrokenFrameset() {
7978
driver.get(appServer.whereIs("framesetPage3.html"));
8079

@@ -156,7 +155,6 @@ public void testShouldBeAbleToSwitchToFrameWithNameContainingDot() {
156155
assertThat(driver.findElement(By.tagName("body")).getText(), containsString("Page number 3"));
157156
}
158157

159-
@Ignore({MARIONETTE})
160158
@Test
161159
public void testShouldBeAbleToSwitchToAFrameUsingAPreviouslyLocatedWebElement() {
162160
driver.get(pages.framesetPage);
@@ -166,7 +164,6 @@ public void testShouldBeAbleToSwitchToAFrameUsingAPreviouslyLocatedWebElement()
166164
assertThat(driver.findElement(By.id("pageNumber")).getText(), equalTo("1"));
167165
}
168166

169-
@Ignore(MARIONETTE)
170167
@Test
171168
public void testShouldBeAbleToSwitchToAnIFrameUsingAPreviouslyLocatedWebElement() {
172169
driver.get(pages.iframePage);
@@ -311,7 +308,6 @@ public void testShouldBeAbleToSwitchToParentFromAnIframe() {
311308
//
312309
// ----------------------------------------------------------------------------------------------
313310

314-
@Ignore({MARIONETTE})
315311
@Test
316312
public void testShouldContinueToReferToTheSameFrameOnceItHasBeenSelected() {
317313
driver.get(pages.framesetPage);

0 commit comments

Comments
 (0)