VB ChromeDriver and Frames

519 views
Skip to first unread message

Michael

unread,
Jan 15, 2012, 1:27:52 AM1/15/12
to Selenium Users
Using vb.net and Selenium to run tests on Chrome. I downloaded the
ChromeDriver from Chromium and can successfully connect to Chrome and
basic interactions with it (going to a specific url, sending
keystrokes). I ran into a problem if the page has a frame and I am
trying to switch to the frame so I can send keystokes to textboxes
inside the frame. I get an error when trying to perform the switch
method. Please note that the code erroring for Chrome works perfectly
fine for Firefox and IE drivers.

I am completely flummoxed by this. Can anyone provide insight into
what is happening, or a workaround/alternative approach?

Code below.

Thanks,
Michael

Both approaches below fail on the SwitchTo method with the error:
"OpenQA.Selenium.NoSuchFrameException: The frame could not be found"


approach one:

Public x2 As OpenQA.Selenium.Remote.RemoteWebDriver '
IWebDriver
Public iquery2 As IWebElement

x2.SwitchTo.Frame("searchPanel")
iquery2 = x2.FindElement(By.Name("search"))
iquery2.Clear()
iquery2.SendKeys(Result & Keys.Enter)

approahc two:

Public x2 As OpenQA.Selenium.Remote.RemoteWebDriver '
IWebDriver
Public iquery2 As IWebElement
x2.SwitchTo.Frame(1)
iquery2 = x2.FindElement(By.Name("search"))
iquery2.Clear()
iquery2.SendKeys(Result & Keys.Enter)

Tarun Bhadauria

unread,
Jan 15, 2012, 4:25:00 AM1/15/12
to seleniu...@googlegroups.com
This syntax remind me of QTP.
Which selenium binding are you using?
Are you sure frame id is - searchPanel
Could you post HTML of you application?

Daniel Wagner-Hall

unread,
Jan 15, 2012, 1:07:40 PM1/15/12
to Selenium Users
Both of these approaches should work. You can try looking up your
frame as an element, i.e.

Public x2 As OpenQA.Selenium.Remote.RemoteWebDriver 'IWebDriver
Public frame As IWebElement
Public iquery2 As IWebElement
frame = x2.FindElement(By.Name("searchPanel"))
x2.SwitchTo.Frame(frame)
iquery2 = x2.FindElement(By.Name("search"))
iquery2.Clear()
iquery2.SendKeys(Result & Keys.Enter)

But either way this sounds like a bug; if we could get the HTML for
the page from you (and javascript and CSS, ideally reduced to the
minimum required to show the problem), we'd quite like to fix the bug!

Michael

unread,
Jan 15, 2012, 5:21:45 PM1/15/12
to Selenium Users
I am using the C# binding (DLLs) but am accessing it via Visual
Basic.net through Visual Studio 2010. I am certain of the name of the
iFrame -- I am trying to access the same iframe on the same page with
Firefox, IE and Chrome to make sure each browser works properly, so I
copied the working code I used for Firefox to use with Chrome. I will
try to get the html (thinned out to manageable size, of course) for
you.

Thanks,
Michael

Michael

unread,
Jan 15, 2012, 6:17:01 PM1/15/12
to Selenium Users
What's the preferred way to post the reduced html/css code? Paste it
inline in a message or an external link to a zip? I am not sure what
the standard operating procedure is.

Michael

Tarun Bhadauria

unread,
Jan 15, 2012, 10:40:37 PM1/15/12
to seleniu...@googlegroups.com
You could post it inline

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.




--
^T
Selenium

Daniel Wagner-Hall

unread,
Jan 16, 2012, 1:12:37 PM1/16/12
to Selenium Users
Anything which gets it to us :) We tend to be fairly heavy users of
https://gist.github.com

Thanks,

Michael

unread,
Jan 17, 2012, 7:45:05 PM1/17/12
to Selenium Users
Working on simplifying and sanitizing the html/css - and then
verifying that the simplifed html still has the problem. Should be
another day or two before I can post it.

Thanks for your patience,
Michael

On Jan 16, 1:12 pm, Daniel Wagner-Hall <dawag...@gmail.com> wrote:
> Anything which gets it to us :) We tend to be fairly heavy users ofhttps://gist.github.com
>
> Thanks,
>
> On Jan 15, 11:17 pm,Michael<goll...@gmail.com> wrote:
>
>
>
>
>
>
>
> > What's the preferred way to post the reduced html/css code?  Paste it
> > inline in a message or an external link to a zip?  I am not sure what
> > the standard operating procedure is.
>
> >Michael
>
> > On Jan 15, 5:21 pm,Michael<goll...@gmail.com> wrote:
>
> > > I am using the C# binding (DLLs) but am accessing it via Visual
> > > Basic.net through Visual Studio 2010.  I am certain of the name of the
> > > iFrame --  I am trying to access the same iframe on the same page with
> > > Firefox, IE andChrometo make sure each browser works properly, so I
> > > copied the working code I used for Firefox to use withChrome.  I will
> > > try to get the html (thinned out to manageable size, of course) for
> > > you.
>
> > > Thanks,
> > >Michael
>
> > > On Jan 15, 4:25 am, Tarun Bhadauria <tkum...@gmail.com> wrote:
>
> > > > This syntax remind me of QTP.
> > > > Which selenium binding are you using?
> > > > Are you sureframeid is - searchPanel

Michael

unread,
Jan 18, 2012, 11:48:47 PM1/18/12
to Selenium Users
Here is the link to my test files: http://www.largedocument.com/2/bdac0d06/test.zip.
I confirmed that the problem still exists for these simplified html/
css files. The optimal solution that I am looking for is to find a
way to be able to grab the "searchPanel" iframe by name, with the goal
of being able to drill down into that frame to find the text input box
named 'search' so that I can run various tests by inserting text into
the text box. Regardless I need a way of drilling to the input text
box. Just to reiterate - I am using VB.net (the C# binding of
selenium) to automate Chrome.

Feel free to ask me any questions.

Thanks in advance,
Michael

Michael

unread,
Jan 31, 2012, 12:55:10 PM1/31/12
to Selenium Users
Bump. Anyone have any thoughts?

Thanks,
Michael

On Jan 18, 11:48 pm, Michael <goll...@gmail.com> wrote:
> Here is the link to my test files:  http://www.largedocument.com/2/bdac0d06/test.zip.
> I confirmed that the problem still exists for these simplified html/
> css files.  The optimal solution that I am looking for is to find a
> way to be able to grab the "searchPanel"iframeby name, with the goal
> of being able to drill down into that frame to find the text input box
> named 'search' so that I can run various tests by inserting text into
> the text box.  Regardless I need a way of drilling to the input text
> box.  Just to reiterate - I am using VB.net (the C# binding of
> selenium) to automate Chrome.
>
> Feel free to ask me any questions.
>
> Thanks in advance,Michael
>
> On Jan 17, 7:45 pm,Michael<goll...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Working on simplifying and sanitizing the html/css - and then
> > verifying that the simplifed html still has the problem.  Should be
> > another day or two before I can post it.
>
> > Thanks for your patience,Michael
>
> > On Jan 16, 1:12 pm, Daniel Wagner-Hall <dawag...@gmail.com> wrote:
>
> > > Anything which gets it to us :) We tend to be fairly heavy users ofhttps://gist.github.com
>
> > > Thanks,
>
> > > On Jan 15, 11:17 pm,Michael<goll...@gmail.com> wrote:
>
> > > > What's the preferred way to post the reduced html/css code?  Paste it
> > > > inline in a message or an external link to a zip?  I am not sure what
> > > > the standard operating procedure is.
>
> > > >Michael
>
> > > > On Jan 15, 5:21 pm,Michael<goll...@gmail.com> wrote:
>
> > > > > I am using the C# binding (DLLs) but am accessing it via Visual
> > > > > Basic.net through Visual Studio 2010.  I am certain of the name of the
> > > > >iFrame--  I am trying to access the sameiframeon the same page with

Luke Inman-Semerau

unread,
Jan 31, 2012, 2:28:13 PM1/31/12
to seleniu...@googlegroups.com
looks like all you need is 
driver.SwitchTo().Frame("searchPanel");
driver.FindElement(By.Id("searchInput")).SendKeys("some query");
driver.FindElement(By.Id("tlsBtn").Click();
driver.SwitchTo().DefaultContent();
# ...
#more switchTo()'s depending on which frame
# do what you need to do...

that's c# I'm guessing you can translate to VB

Michael

unread,
Feb 2, 2012, 12:49:48 AM2/2/12
to Selenium Users
driver.SwitchTo().Frame("searchPanel"); (in my case the VB equivalent
of same) errors out with the error
"the frame could not be found". Interestingly, I can find this frame
by selecting it like this:

iquery2 = driver.FindElement(By.Name("searchPanel"))

but once I have that, what do I do? Is there a way to feed iquery2 to
as the object (frame) to switch to? My ultimate goal is that I need
to drill down into that frame so I can send some text into an input
box within the markup of that frame.

Michael

Luke Inman-Semerau

unread,
Feb 2, 2012, 1:28:13 AM2/2/12
to seleniu...@googlegroups.com
You should be able to pass that webelement to the Frame method, it can take either a number (index of the frame), frame name (string), or a webelement.

-Luke

Michael

unread,
Feb 2, 2012, 11:51:17 AM2/2/12
to Selenium Users
Luke, thank you for the recommendation --that worked. For some
reason, only the first two overloads of the method (passing index of
the frame, or name of frame) showed in my IDE - the overload for
passing the webelement was hidden. That's part of why I was having
problems. The other bit is that I might have gotten confused from
trying so many different things, and lost track of what I had tried
and not tried.

Thanks to everyone for your help.
Michael

On Feb 2, 1:28 am, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> You should be able to pass that webelement to the Frame method, it can take either a number (index of the frame), frame name (string), or a webelement.
>
> -Luke
>
> On Feb 1, 2012, at 9:49 PM,Michael<goll...@gmail.com> wrote:
>
>
>
>
>
>
>
> > driver.SwitchTo().Frame("searchPanel"); (in my case the VB equivalent
> > of same) errors out with the error
> > "the frame could not be found".  Interestingly, I can find this frame
> > by selecting it like this:
>
> > iquery2 = driver.FindElement(By.Name("searchPanel"))
>
> > but once I have that, what do I do?  Is there a way to feed iquery2 to
> > as the object (frame) to switch to?  My ultimate goal is that I need
> > to drill down into that frame so I can send some text into an input
> > box within the markup of that frame.
>
> >Michael
>
> > On Jan 31, 2:28 pm, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> >> looks like all you need is
> >> driver.SwitchTo().Frame("searchPanel");
> >> driver.FindElement(By.Id("searchInput")).SendKeys("some query");
> >> driver.FindElement(By.Id("tlsBtn").Click();
> >> driver.SwitchTo().DefaultContent();
> >> # ...
> >> #more switchTo()'s depending on which frame
> >> # do what you need to do...
>
> >> that's c# I'm guessing you can translate to VB
>
> >> On Tue, Jan 31, 2012 at 9:55 AM,Michael<goll...@gmail.com> wrote:
> >>> Bump.  Anyone have any thoughts?
>
> >>> Thanks,
> >>>Michael
>
Reply all
Reply to author
Forward
0 new messages