Open DamienLyles opened 7 years ago
The issue report is slightly misleading: it does not scroll the button in the <iframe>
into view, causing the click to be dispatched to the wrong location, but I’m able to reproduce it using the attached sample HTML. This happens even with the WebDriver conforming implementation of the Element Click command.
My immediate guess is that the element.isInView
calculations are incorrect when an element sits inside a frame because it uses the top window’s boundaries and does not take into account that its own window might not be inside the viewport of the top-level window. This seems like a pretty clear flaw in the WebDriver specification.
I’m able to make click the button if I first scroll the button into view explicitly using execute_script("arguments[0].scrollIntoView", (button1,))
and then clicking.
You can replicate this pretty easily using Selenium's ClickScrollingTest
. The two tests to look at are:
testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOutOfView
, and testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrame
.
To run them, open the project in IntelliJ, open ClickScrollingTest
, run it. You may need to edit the test configuration to include -Dselenium.browser=ff
in the VM options.
For some reason there tests work on travis: https://travis-ci.org/SeleniumHQ/selenium/jobs/224611764#L822 https://travis-ci.org/SeleniumHQ/selenium/jobs/224611764#L874
@andreastt you set the specification
label, but was an issue ever filed?
In order to help us efficiently investigate your issue, please provide the following information:
Firefox Version
52.0.2
Platform
e.g. Windows/OSX/Linux Windows 7
Selenium Version selenium-webdriver (3.3.0), geckodriver 0.15.0
Steps to reproduce -
Sample html https://jsfiddle.net/0hdtcyjz/40/
On the sample jsfiddle page...
Click the 'Update iFrame' button. This will load an HTML form into the iFrame found at the bottom of the page, but the user would still need to scroll to get to the iframe. Do NOT scroll to the iframe. Switch to the iframe using something like driver.switch_to.frame driver.find_element(:id,'iframe_id') Attempt to click button1 in the frame driver.find_element(:xpath, "//*[@value='button1']") Selenium will NOT be able to click the button