Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Cannot switch to correct iframe if two iframes have the same name attribute #13789

Closed
g-klein opened this issue Dec 5, 2015 · 1 comment
Closed
Labels

Comments

@g-klein
Copy link

g-klein commented Dec 5, 2015

PhantomJS cannot switch to the correct iframe if two iframes share the same name attribute.

Example HTML:

<!doctype html>    
    <html>    
        <head></head>    
            <body>    
                <div class="div1">    
                    <iframe id="first" name="test" src="invalid"></iframe>     
                </div>   
                <div class="div2">                   
                    <iframe id="second" name="test" src="http://www.example.org"></iframe>    
                 </div>   
             </body>    
    </html>

The following C# code fails unless you comment out the lines which remove the first iframe.

IWebDriver driver = new PhantomJSDriver();
driver.Navigate().GoToUrl(@"file:///C:/dank/test.html");

//var frame1 = driver.FindElement(By.CssSelector("#first"));
//(driver as IJavaScriptExecutor).ExecuteScript("arguments[0].remove()", frame1);

var frame = driver.FindElement(By.CssSelector("#second"));
driver.SwitchTo().Frame(frame);

var div = driver.FindElement(By.TagName("div"));
Console.WriteLine(div.Text);

driver.Quit();
@stale stale bot added the stale label Dec 27, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant