zhengxintong / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

ChromeDriver Won't Switch To Frame #107

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to switch to a frame using Chrome and ChromeDriver.
However ChromeDriver is reporting "The frame could not be found".

Yet the previous step of my code I asked ChromeDriver to find all elements  of 
tagname "frame", and the one I was trying to switch to was returned!

ReadOnlyCollection<IWebElement> frames = Driver.FindElementsByTagName("frame");
            foreach (IWebElement element in frames)
            {
                Console.WriteLine(element.GetAttribute("id"));
                Console.WriteLine(element.GetAttribute("name"));
            }

            Driver.SwitchTo().Frame("frMenu");

The output from the foreach loop is as follows:

frTopLeftPane
brandingTop
frTopBar
topbar
frMenu
menu
frMenuHiddenCol

frMain
main

processing
brandingBottom
brandingBottom

As you can see "frMain" is listed, but won't switch to it in the very next line.

What version of the product are you using? On what operating system?
ChromeDriver = Tried 20.0.1133.0 / 21.0.1180.4 / 22.0.1203.0b
Chrome =20.0.1132.57
OS = Windows 7 Ultimate N

chromedriver.log attached

Original issue reported on code.google.com by RichardB...@gmail.com on 13 Jul 2012 at 2:45

Attachments:

GoogleCodeExporter commented 9 years ago
Can you show a simple HTML page that demonstrates your problem.  Looking at the 
code, I do see one bug that you might be running into.  However, I can't be 
sure unless I see your example HTML.

Original comment by kkania@chromium.org on 6 Aug 2012 at 10:22

GoogleCodeExporter commented 9 years ago
Hello.

Please see attached the a mock up of the HTML.
At a guess the issue might lay with the frame being within within a frameset?

Regards

Original comment by RichardB...@gmail.com on 7 Aug 2012 at 8:13

Attachments:

GoogleCodeExporter commented 9 years ago
I am facing a similar issue with chromedriver, driver is not able to switch to 
particular frame.

Note: Its working perfectly in case of IE Driver. Didn't check with firefox 
driver though.

Original comment by Talwinde...@gmail.com on 14 Aug 2012 at 4:38

GoogleCodeExporter commented 9 years ago
Hi,

I am seeing the same issue. Switching the frame is working fine with IE and 
Firefox however NoSuchFrameFoundException is displayed for Chrome. I would says 
this defect fix priority should be High. As this is very important for 
identifying elements within frame. I am doing Proof of concept using selenium 
webdriver. The defects causing the tool is not fit for the purpose. Can someone 
in the development team should look this issue immediately.

Appreciate your time.

Regards 

Original comment by aha.prav...@gmail.com on 28 Aug 2012 at 2:51

GoogleCodeExporter commented 9 years ago
Hello,

I am having the same problem as well. 
I built my test suite for FF and IE and the tests run fine.
Once I added Chrome into the mix, I get the "NoSuchFrameException" though I can 
see chrome listing the frame I ask it to switchTo.

chromedriver version - 23.0.1240.0
Selenium Server version - 2.25.0

Original comment by alistere...@gmail.com on 4 Sep 2012 at 4:58

GoogleCodeExporter commented 9 years ago
Hi Guys is this got fixed ? if so what version of chrome driver it got fixed ?

Original comment by suchit.b...@gmail.com on 5 Nov 2012 at 6:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi,

This is urgent for me, please let know when this issue would be fixed.

Original comment by sreevats...@gmail.com on 15 Dec 2012 at 11:36

GoogleCodeExporter commented 9 years ago
It's urgent for me as well, and I have the same guess with RichardB that frames 
inside frameset can not be switched to.

Original comment by mengjie1...@gmail.com on 14 Jan 2013 at 2:13

GoogleCodeExporter commented 9 years ago
I m facing the same problem,

case:  
<frameset>
<frame />
<frameset>
<frame id=head />
<frame id=main />
</frameset>
</framset>

so, I guess that if the second frameset need a id or name ?

we can first switch to the the cascading frameset, then switch to the frame 
"main"?

but it's a little mess.

Did somebody found some easy way to fix the problem ?

Original comment by fy.ke...@gmail.com on 27 Feb 2013 at 2:17

GoogleCodeExporter commented 9 years ago
The problem is that unlike FirefoxDriver which can switch to a frame across a 
frameset, ChromeDriver can find a frame across a frameset but cannot switch to 
it using driver.switchTo().frame(String) or driver.switchTo().frame(index).  
ChromeDriver can switch to a frame across a frameset using 
driver.switchTo().frame(WebElement).  The workaround is to use 
WebElement elem = driver.findElement(By.xpath("//frame[1]")); 
driver.switchTo().frame(elem);
so in the above case you can use
WebElement elem = null;
driver.switchTo().defaultContent();
elem = driver.findElement(By.xpath("//frame[1]")); //since this has no id or 
name
driver.switchTo().frame(elem);
elem = driver.findElement(By.xpath("//frame[@id='head']")); 
driver.switchTo().frame(elem);

Original comment by ghong...@gmail.com on 8 Mar 2013 at 6:07

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 13 Mar 2013 at 11:55

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:20

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 9:21

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 14 Mar 2013 at 10:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
#16, I'm sorry you are having a rough time with frames. If you can come up with 
a simple html page the exhibits your problem, hopefully we can discover and fix 
the issue.

Original comment by kka...@google.com on 6 Sep 2013 at 6:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Chromedriver 2.3 fixed this problem for me using Cucumber, Capybara on Linux 
Ubuntu server.

Original comment by onno.van...@gmail.com on 6 Sep 2013 at 8:54

GoogleCodeExporter commented 9 years ago

Original comment by kkania@chromium.org on 30 Sep 2013 at 10:52

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Attached a working POC that demonstrates the problem in ChromeDriver. This 
issue still exists in ChromeDriver ChromeDriver (v2.4.226107). Hope that they 
will fix this soon since this is more than a year old defect.

Operating System: Windows 8 Pro 64bit
Binding: .Net
WebDriver: 2.35.0
Chrome: Version 30.0.1599.66 m

For now, I will use the work around in using web element instead of the name as 
parameter.

Original comment by ruffy.lo...@gmail.com on 6 Oct 2013 at 6:04

Attachments:

GoogleCodeExporter commented 9 years ago
this issue still exist. running fine though fr firefox and ie. chrome switch 
frame displays NoSuchFrameFoundException.

Original comment by s.sindhu...@gmail.com on 8 Jan 2014 at 5:05

GoogleCodeExporter commented 9 years ago
Bug still exists, spent several hours to finally narrow it down to this. 

selenium.common.exceptions.NoSuchFrameException: Message: 'no such frame\n  
(Session info: chrome=32.0.1700.107)\n  (Driver info: 
chromedriver=2.9.248307,platform=Mac OS X 10.8.5 x86_64)

such an important feature, needs to be fixed.

Original comment by DokoSatc...@gmail.com on 15 Feb 2014 at 11:50

GoogleCodeExporter commented 9 years ago
I am using selenium components for cross browser with coded Ui in vsts2012 
premium and I am facing the same issue on chromedriver 2.9.
Everything is working fine with IE and firefox but playback fails on chrome 
after login on a page.

Operating System: Windows 7 32 bit
Binding: .Net
WebDriver: 2.35.0
Chrome: Version 32.0.1700.107
Exception: selenium.common.exceptions.NoSuchFrameException

Original comment by kimichou...@gmail.com on 11 Mar 2014 at 4:27

GoogleCodeExporter commented 9 years ago
I am also facing the same problem with the latest Chrome Driver version 2.29. 
Can you please let me know this can be fixed any time early. 

Please help us with a workaround so that we can use that for time being until 
this issue gets fixed. 

Original comment by arun280...@gmail.com on 10 Apr 2014 at 4:37

GoogleCodeExporter commented 9 years ago
Are there any plans for fixing this issue?
Still available on Chrome Webdriver: v2.9.248315

Original comment by piotr.st...@gmail.com on 16 May 2014 at 2:55

GoogleCodeExporter commented 9 years ago
I am also facing the same issue. The IE and FF works fine. When I execute the 
same script for Chrome, it fails with exception 
"org.openqa.selenium.NoSuchFrameException: no such frame: element is not a 
frame"

Is there any workaround for this issue. This is blocking my test script 
execution on Chrome browser.

Original comment by munagar...@gmail.com on 30 Jul 2014 at 1:59

GoogleCodeExporter commented 9 years ago
Following workaround works for me in Chrome Webdriver and Ruby:

    frame_element = page.driver.browser.find_element(:id => frame_id)
    page.driver.browser.switch_to.frame(frame_element)

Original comment by piotr.st...@gmail.com on 19 Aug 2014 at 1:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi! I have found a problem. It is reproduced on a hybrid Android app. Details 
are here: https://github.com/appium/appium/issues/3792

Is it going to be fixed? Is there some workaround? 

Original comment by Tichomir...@gmail.com on 10 Oct 2014 at 7:14

GoogleCodeExporter commented 9 years ago
It seems to me, that this is still not working in chromedriver 2.41.0.

I'm using it via phantomjsdriver (1.2.0) maven dependency in Java.

I upgraded chromedriver dependency to latest version 2.44.0 (which by the way 
is missing Gson dependency) and still not working.

Created SO for that - easier to read: 
http://stackoverflow.com/questions/27824524/chromedriver-is-not-switching-frames
-properly

Original comment by betlista@gmail.com on 7 Jan 2015 at 4:57

GoogleCodeExporter commented 9 years ago
Hi,

I'm also having this issue with switching to frames inside nested framesets. I 
had a look at the ChromeDriver source, and it seems like there's a suspicious 
XPath expression in window_commands.cc around line 317. The query 
"/html/frameset/frame" can only find frames inside the top level frameset. For 
nested framesets, the query should be something like "/html//frameset/frame" or 
"/html/frameset//frame".

Running some JavaScript on the page that hooks document.evaulate and replaces 
"/html/frameset/frame" with "/html//frameset/frame" in the first argument fixes 
the bug for our project. This workaround is attached.

I also tried selecting the <frame> element itself and switching to that, but it 
seemed to trigger a different bug, where using elements inside the nested frame 
gave "stale element reference" errors.

Original comment by RossyMi...@gmail.com on 13 Feb 2015 at 1:22

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:19

GoogleCodeExporter commented 9 years ago
Hi,

If you're still having problems with the workaround try this:
Not sure how to find the frameset by xpath, so I have used CSS and I'm doing it 
in vba so not sure how to convert to proper code, but here's a shot!

fs = driver.findElement(By.cssselector("html > frameset:nth-child(2)"));
fr = fs.findElement(By.xpath("//frame[1]")); //since this has no id or name
driver.switchTo().frame(fr);

Original comment by s...@mcclellandyarr.co.uk on 2 Mar 2015 at 3:09

GoogleCodeExporter commented 9 years ago
Issue is reproducible with latest chromedriver.

If a frame is under nested frameset, chromedriver is unable to switch to it 
using name or id. i.e driver.switchto.frame(name/id) - Throws 'no such frame' 
error.

Workaround is to switch to frame using driver.switchto.frame(webElement). 

Issue is not reproducible with FirefoxDriver.

Sample Code:
                System.setProperty("webdriver.chrome.driver",Utility.getPath("drivers/chromedriver.exe"));
                WebDriver driver = new ChromeDriver();
                driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES);
                driver.get(Utility.getExternalPath("Html/Bug_107.html"));

                WebElement tmpFrame=null;
                List<WebElement> frames = driver.findElements(By.tagName("frame"));
                for(WebElement element:frames){
                        System.out.println(element.getAttribute("id")+"\t"+element.getAttribute("name"));
                        if(element.getAttribute("name").equals("menu")){
                                tmpFrame=element;
                        }
                }

                driver.switchTo().frame("menu");
                // driver.switchTo().frame(tmpFrame); // This works fine

                driver.findElement(By.id("input1")).sendKeys("152354");

Original comment by ssudunag...@chromium.org on 4 Jun 2015 at 9:42

Attachments:

GoogleCodeExporter commented 9 years ago
Issue is reproducible only on Windows platform
Works fine on Linux and Mac
chromedriver version - 2.16
chrome browser - 43.0.2357.134

Original comment by gmanikp...@chromium.org on 20 Jul 2015 at 9:21