Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

contextClick does not work in iframe (firefox) #2950

Closed
lukeis opened this issue Mar 3, 2016 · 14 comments
Closed

contextClick does not work in iframe (firefox) #2950

lukeis opened this issue Mar 3, 2016 · 14 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2950

if <iframe> element is not the first one in html structure of the page - contextClick
doesn't work as expected.

Webdriver performs "contextClick" higher position where element is located.
deviation of clicking position equals height of first element on the page.

i've attached test pages and code that tries to perform contextClick on link inside
of IFRAME.

webdriver.switchTo().frame("Frame");
new Actions(webdriver).contextClick(webdriver.findElement(By.name("google2"))).build().perform();

on this test page - issue is reproducible only in Firefox, but on real project with
more complex pages - we have the same issue in IE.

Reported by george.astashonok on 2011-11-28 12:50:40


- _Attachment: [iframe.htm](https://storage.googleapis.com/google-code-attachments/selenium/issue-2950/comment-0/iframe.htm)_ - _Attachment: [index.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-2950/comment-0/index.html)_ - _Attachment: ContextMenu.png
![ContextMenu.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-2950/comment-0/ContextMenu.png)_
@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-11-29 18:33:59

  • Labels added: Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

It seems like once the element coordinates are retrieved, right click is happening with
respect to browser view port instead of doing the click relative to frame.

Alternate to ContextClick, you can use keyboard shortcut Shift+F10 to simulate right
click on the element. Something as below:

WebElement element=driver.findElement(By.name('x');
element.sendKeys(keys.chord(Keys.SHIFT, Keys.F10));

Reported by javasparkle on 2011-11-29 21:48:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

actually, we need simulate right click on element - there is listener of events, that
starts not native context menu of webLink, but custom Flex context menu.
in selemium RC it worked fine.

Reported by george.astashonok on 2011-12-01 08:04:30

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Basically the issue has nothing to do with right click. The problem is that WebDriver
calculates element rectangle incorrectly.

Reported by nebehr.gudahtt on 2011-12-01 18:01:20

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

any updates on this?thank you

Reported by nayakharish on 2012-02-08 13:07:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

really need this function.  right click has been a big issue in my automation testing.
 any updates on this? or any work around, please?

Reported by richardlin35 on 2012-08-07 08:05:18

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

The only workaround I found so far is to disable the native events in Firefox Driver.
It had worked for me.
Btw, the same issue happens not only with the right click but with double click too.

Reported by FibYar on 2012-11-17 14:57:20

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Is this issue still actual? I've checked that Selenium 2.29 with FF18 works as expected
(win7, with native events enabled). Which browser versions are affected?

Reported by barancev on 2013-02-01 09:59:47

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Tried out with Firefox 10ESR and Selenium 2.29 on Windows 7. It works as it should :)

Reported by FibYar on 2013-02-04 05:10:37

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hmmm... My page has a following structure: defaultContent, a frame in it, an iframe
in that frame, one more frame in that iframe. And I got some table in that frame. When
I've tried to doubleClick the last element in that page, I get an error (I don't get
this if I'm using synthetic events).
I hope this could to help somehow... Sorry for not providing you a sample page.
org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: Given coordinates
(845, 603) are outside the document. Error: MoveTargetOutOfBoundsError: The target
location (845, 603) is not on the webpage.
Command duration or timeout: 10 milliseconds
Build info: version: '2.29.0', revision: '58258c3', time: '2013-01-17 22:46:35'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version:
'1.6.0_38'
Session ID: d164d306-00b0-4fd1-964e-c3b2986a4634
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox,
rotatable=false, locationContextEnabled=true, version=10.0.10, cssSelectorsEnabled=true,
databaseEnabled=true, handlesAlerts=true, nativeEvents=true, webStorageEnabled=true,
applicationCacheEnabled=true, takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
    at org.openqa.selenium.remote.RemoteExecuteMethod.execute(RemoteExecuteMethod.java:34)
    at org.openqa.selenium.remote.RemoteMouse.mouseMove(RemoteMouse.java:88)
    at org.openqa.selenium.interactions.internal.MouseAction.moveToLocation(MouseAction.java:48)
    at org.openqa.selenium.interactions.DoubleClickAction.perform(DoubleClickAction.java:36)
    at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:31)
    at org.openqa.selenium.interactions.Actions.perform(Actions.java:356)

Reported by FibYar on 2013-02-04 05:40:36

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Closing as fixed. The last comment is not related to the original issue, if it still
actual please raise a new issue.

Reported by barancev on 2013-05-16 19:02:11

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Can someone say how one can obtain a version of WebDriver with this fix in it?  Must
I build from the latest source or wait for a new official build?

Reported by david@42andpark.com on 2013-05-18 20:38:50

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

The fix should be already included in the released version 2.32

Reported by barancev on 2013-05-18 20:50:04

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:16

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant