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

FirefoxDriver hangs when clicking an element in an iframe generates a modal window / alert. #1305

Closed
lukeis opened this issue Mar 2, 2016 · 23 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 1305

What steps will reproduce the problem?
1. Point webdriver towards a page with an iframe on it that contains an element that
generates an alert or modal window (*use the attached parent.html as an example).
2. Tell webdriver to switchTo().frame() of the iframe.
3. Call click() on the WebElement that should generate the alert or the modal dialog.

What is the expected output?
Webdriver should work with alerts generated by iframe elements the same way they are
worked with for

What do you see instead?
Webdriver appears to be "locked" and hanging on the alert/modal generating window.
 The WebDriver status label on the browser remains red while the modal/alert is visible.
 Code execution appears to hang at this point waiting for a response from the click()
method.

Dismissing the alert, or closing the modal window returns execution back to WebDriver
and to the test code.


What version of the product are you using? On what operating system?
2.0b1 on Windows XP

Please provide any additional information below:

I've attached some sample code for how I was able to reproduce this problem.  The parent.html
file contains an alert generating link as well as as iframe.  The "iframer.html" file
contains the content of parent.html's iframe including a link to generate the alert.



Reported by swimminschrage on 2011-02-15 23:07:42


- _Attachment: [parent.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-1305/comment-0/parent.html)_ - _Attachment: [iframer.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-1305/comment-0/iframer.html)_ - _Attachment: [IFrameClickTest.java](https://storage.googleapis.com/google-code-attachments/selenium/issue-1305/comment-0/IFrameClickTest.java)_
@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This also appears to happen when the Alert is generated from the iframe's onload event.

Please let me know if you want some sample code for this scenario as well.

--Swimminschrage

Reported by swimminschrage on 2011-02-16 19:01:45

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Still got this problem on selenium-java-b2. When would this issue fixed?

Reported by qiuyunzhong on 2011-03-23 08:45:29

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Having same issue, in b3

Reported by jweber72 on 2011-03-24 20:20:53

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Having the same issue in b2

Reported by van.isacker.pieter on 2011-03-29 06:50:08

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Same problem here. Firefox4, selenium2b3
Trying to accept an alert that is launched from a frame. But the script hangs on the
click command that launches the frame, until I manually accept it.

Reported by leo.lathspell on 2011-04-07 16:18:09

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I modified java/client/test/org/openqa/selenium/AlertsTest.java to include the iframe
alert test.

This might be useful for you to see the problem, and to avoid regressions once the
issue is fixed.

Reported by leo.lathspell on 2011-04-08 15:54:51


- _Attachment: [frameAlertTest.patch](https://storage.googleapis.com/google-code-attachments/selenium/issue-1305/comment-6/frameAlertTest.patch)_

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by jari.bakken on 2011-04-22 14:14:49

  • Labels added: Component-WebDriver, Browser-Firefox

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

After tracing through the code, this bug is caused by the selenium firefox driver's
javascript not responding when the alert is launched from framed HTML.  The method
in question is webdriver.modals.findAssociatedDriver_ in modals.js.

Using the failing unit test from comment #6, I've fixed the issue.  Apply the patch
from comment #6, then apply this patch.

Reported by mike@reedell.com on 2011-04-25 12:57:14


- _Attachment: [bug1305.patch](https://storage.googleapis.com/google-code-attachments/selenium/issue-1305/comment-8/bug1305.patch)_

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by jari.bakken on 2011-05-25 20:27:35

  • Status changed: Accepted

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

leo.lath...@gmail.com and m...@reedell.com:

Could I ask you to sign the CLA? It can be signed electronically at the bottom of the
page.

  http://code.google.com/legal/individual-cla-v1.0.html

It would make applying this patch possible.



Reported by jari.bakken on 2011-05-25 20:41:35

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Yes, no problem.

Reported by leo.lathspell on 2011-05-27 02:45:40

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This issue was closed by revision r12439.

Reported by jari.bakken on 2011-06-10 16:07:11

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'm still seeing this issue (using the same test files from the original submission)
with Selenium 2.0rc2 and Firefox3.6/4.0 (both).  Webdriver hangs (with the Webdriver
plugin red) after the javascript alert from the iframe appears.

I am using the 2.0rc2 from Maven.  Is it possible the fix wasn't included in the maven
build of WebDriver 2.0rc2?

Reported by swimminschrage on 2011-06-10 21:09:01

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Sure it does not work in 2.0rc2, the patch was applied to trunk and will be available
in the next release.

Reported by barancev on 2011-06-10 21:43:29

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'm still seeing this issue in Selenium 2.0rc3. Can someone please guide me how to apply
the patch?

Thanks :)

Reported by gnr.rakesh on 2011-07-07 11:55:07

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Same problem here. Right now i am working on File Upload automation.
I am using AutoIt for selecting the file.

The problem is when  I  click on Browse button windows OS dialog (to select file) opening.
But Webdrivier is not releasing from click event. So the code after clicking Browse
button is not executing.


Reported by kotisamudrala on 2011-12-08 23:58:40

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

To automate uploading files DO NOT click on the WebElement.  Just call WebElement.sendKeys("path/to/file").
 It will do what you want.

Reported by dawagner on 2011-12-13 00:06:49

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I am facing the same issue in IE8.

When i select an option from a select list, it will display a confirm pop up and then
the script hangs until i manually accept/close the pop up.

this is working fine in firefox. I am using selenium-server-2.15.0.jar.

Reported by jithumangad on 2012-03-05 11:53:52

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This is a separate issue. The scenario you describe is a known limitation of the IE
driver, and it's a perfect example of why we prefer to use "native events" instead
of simulating them via JavaScript. However, IE does not allow us to use native events
to click on options in a select list, so we have to resort to using JavaScript, which
will block on an alert.

Reported by james.h.evans.jr on 2012-03-05 12:01:36

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'm facing the same issue with chrome driver and latest selenium version (2.20).
Click from within an iframe that opens another window causes WebDriver to block the
application.
Is there a workaround or a fix to this issue?

Reported by pavgreen on 2012-03-20 12:12:34

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'm facing this issue with firefox 3.6.12 and selenium-java (2.16.1 and 2.21.0 both).
Firefox driver hangs when click a button(located in iframe) which opens a confirm dialog.
But there is no issue with chrome(18.0.1025.168 m) browser. The status of this issue
says that it is fixed but i am still seeing this issue. Can someone guide me with the
correct version where this fix is incorporated or any workaround to fix this issue?

Reported by premila.viswanath on 2012-05-08 16:24:19

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

@premila.viswanath: you may be faced with issue 3825, that is fixed and the fix will
be availavle in 2.22

Reported by barancev on 2012-05-16 11:49:11

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 18:11:56

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 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