-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox fails to switch out of iframe #205
Labels
Comments
I will take a look, thanks. |
This also affects private bool FrameContentsMatch(IWebElement e,
string locator,
Options options)
{
var currentHandle = _selenium.CurrentWindowHandle;
try
{
var frame = _seleniumWindowManager.SwitchToFrame(e);
return
frame.Title == locator ||
frame.FindElements(By.XPath($".//h1[{_xPath.IsText(locator, options)}]"))
.Any();
}
finally
{
_selenium.SwitchTo()
.Window(currentHandle);
// Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1305822
if (_selenium is FirefoxDriver)
{
_selenium.SwitchTo()
.DefaultContent();
}
}
} |
Hi @obstar, |
This was referenced Jun 21, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have discovered that when switching into an iframe using Firefox, the scope gets set to the iframe scope and does not switch back (like it does in e.g. Chrome) when trying to select elements in the outer scope. They can't be found.
Some digging revealed that Firefox Marionette does not switch back to the
DefaultContent
when switching out of an iframe usingSwitchTo().Window(...)
. This issue is known to Mozilla and a bug report can be found here. Since it appears like it will not be fixed by Mozilla in the near future, have you considered adding a fix to your library?It would seem that the issue could be fixed by changing
SeleniumWindowManager.SwitchToWindow(...)
to the following:This would make sure that the context resets to the
DefaultContent
like it should do, according to the W3C WebDriver specification, and does not have any side effects.The text was updated successfully, but these errors were encountered: