My guess is maybe a syncronisation problem?
try

@browser.window(:title,/66.pdf/).when_present() do
  ....
end

On Feb 14, 6:19 am, Joe Fleck <[email protected]> wrote:
> I simplified the my code to the following:
> @browser.window(:title,/66.pdf/).exists?
> true
> @browser.window(:title,/66.pdf/).close
>
> and it worked.
>
> I tried the following:
>
> @browser.window(:title,/66.pdf/).use do
> @browser.window(:title,/66.pdf/).close end
>
> error:
> Watir::Exception::NoMatchingWindowFoundException: {:title=>/66.pdf/}
>         from 
> /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/l 
> ib/watir-webdriver/window_switching.rb:122:in
> `locate'
>         from 
> /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/l 
> ib/watir-webdriver/window_switching.rb:106:in
> `handle'
>         from 
> /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/l 
> ib/watir-webdriver/window_switching.rb:99:in
> `use'
>         from (irb):172
>         from 
> /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/openssl/x509. 
> rb:125
>
> Thank you,
> Joe
>
>
>
>
>
>
>
> On Mon, Feb 13, 2012 at 2:03 PM, Joe Fleck <[email protected]> wrote:
> > Hi all,
>
> > The below code is include the title on the new tab.  It errors out.
> > Does anyone know why?
>
> > @browser.window(:title =>
> > "/onboard-advisory-board/rooms/123/topics/135/resources/582/conversions/66. 
> > pdf").use
> > do
> >    @browser.window(:title =>
> > "/onboard-advisory-board/rooms/123/topics/135/resources/582/conversions/66. 
> > pdf").click
> > end
>
> > Watir::Exception::NoMatchingWindowFoundException:
> > {:title=>"/onboard-advisory-board/rooms/123/topics/135/resources/582/conver 
> > sions/66.pdf"}
> >        from 
> > /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/l 
> > ib/watir-webdriver/window_switching.rb:122:in
> > `locate'
> >        from 
> > /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/l 
> > ib/watir-webdriver/window_switching.rb:106:in
> > `handle'
> >        from 
> > /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/l 
> > ib/watir-webdriver/window_switching.rb:99:in
> > `use'
> >        from (irb):147
> >        from 
> > /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/openssl/x509. 
> > rb:125
>
> > Do i need to install an additional gem to make this work?  Is there an
> > issue using a MAC?
>
> > Thank you,
> > Joe
>
> > On Mon, Feb 13, 2012 at 9:47 AM, Joe Fleck <[email protected]> wrote:
> >> Hi,
>
> >> I looked at the link you provided but I am not able to get this to
> >> work.  I don't see a title name for the new tab when the
> >> document/image opens.  I tried using the div id=viewer and that did
> >> not work.  I have included the html for the page below.
>
> >> <html>
> >> <head>
> >> <title>/onboard-advisory-board/rooms/123/topics/135/resources/574/conversio
> >>  ns/53.pdf"</title>
> >> <link type="text/css" rel="stylesheet" media="screen"
> >> href="http://localhost:3000/cdk/products/advisory_board/stylesheets/pdf_vie...";>
> >> <script src="/cdk/products/cdk/javascripts/jquery-1.6.1.min.js"
> >> type="text/javascript">
> >> <script src="/cdk/products/advisory_board/javascripts/pdf_compatibility.js"
> >> type="text/javascript">
> >> <script src="/cdk/products/advisory_board/javascripts/pdf.js"
> >> type="text/javascript">
> >> <script src="/cdk/products/advisory_board/javascripts/pdf_jpg.js"
> >> type="text/javascript">
> >> <script src="/cdk/products/advisory_board/javascripts/pdf_viewer.js"
> >> type="text/javascript">
> >> <script type="text/javascript">
> >> </head>
> >> <body>
> >> <div id="controls">
> >> <div id="errorWrapper" hidden="true">
> >> <div id="sidebar">
> >> <div id="loading" hidden="true">Loading... 0%</div>
> >> <div id="viewer">
> >> <a name="1"></a>
> >> <div id="pageContainer1" class="page" style="width: 544px; height:
> >> 361.28px;" data-loaded="true">
> >> </div>
> >> </body>
> >> </html>
>
> >> This is the code i have tried:
> >> @browser.window(:id,'viewer').use do @browser.window(:id,'viewer').close 
> >> end
>
> >> There is not button to click and close the tab.
>
> >> Any help would be greatly appreciate.
>
> >> Thank you,
> >> Joe
>
> >> On Thu, Feb 9, 2012 at 11:16 AM, Željko Filipin
> >> <[email protected]> wrote:
> >>> On Thu, Feb 9, 2012 at 5:26 AM, Joe fleck <[email protected]> wrote:
> >>>> I am using watir-webdriver.
>
> >>> Thank take a look at this page:
>
> >>>http://watirwebdriver.com/browser-popups/
>
> >>> Željko
>
> >>> --
> >>> Before posting, please readhttp://watir.com/support. In short: search
> >>> before you ask, be nice.
>
> >>> [email protected]
> >>>http://groups.google.com/group/watir-general
> >>> [email protected]

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to