Skip to content

Commit 6369b48

Browse files
committed
Fixing interactions API in Firefox to be able to move mouse to elements in frames using native events. Fixes issue 7253
1 parent c1358e8 commit 6369b48

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<head>
3+
<title>click iframe</title>
4+
</head>
5+
<body><a id="link" href="submitted_page.html" target="_top">Click me</a></body>
6+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<head>
3+
<title>click in iframe</title>
4+
</head>
5+
<body>
6+
<iframe id="ifr" src="click_iframe.html" style="margin: 200px; width: 100px; height: 50px;" />
7+
</body>
8+
</html>

java/client/test/org/openqa/selenium/interactions/CombinedInputActionsTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,24 @@ private void navigateToClicksPageAndClickLink() {
196196
wait.until(titleIs("XHTML Test Page"));
197197
}
198198

199+
@Ignore(value = {ANDROID, IPHONE, OPERA, PHANTOMJS, SAFARI}, reason = "Not tested")
200+
@Test
201+
public void canMoveMouseToAnElementInAnIframeAndClick() {
202+
driver.get(appServer.whereIs("click_tests/click_in_iframe.html"));
203+
204+
wait.until(presenceOfElementLocated(By.id("ifr")));
205+
driver.switchTo().frame("ifr");
206+
207+
WebElement link = driver.findElement(By.id("link"));
208+
209+
new Actions(driver)
210+
.moveToElement(link)
211+
.click()
212+
.perform();
213+
214+
wait.until(titleIs("Submitted Successfully!"));
215+
}
216+
199217
@Ignore({IPHONE})
200218
@Test
201219
public void testCanClickOnLinks() {

javascript/firefox-driver/js/firefoxDriver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ FirefoxDriver.prototype.mouseClick = function(respond, parameters) {
12971297
}
12981298

12991299
var doc = respond.session.getDocument();
1300-
var elementForNode = getElementFromLocation(respond.session.getMousePosition(), doc);
1300+
var elementForNode = getElementFromLocation(respond.session.getMousePosition(), respond.session.getTopDocument());
13011301

13021302
var nativeMouse = Utils.getNativeMouse();
13031303
var node = Utils.getNodeForNativeEvents(elementForNode);

0 commit comments

Comments
 (0)