Hi sorry once again, please read this.

If I want to switch the window again I should not using block. I need to
use the way you are using without block

On Tue 7 Aug, 2018, 11:54 PM Titus Fortner, <titusfort...@gmail.com> wrote:

> What are you asking? The block should not close the window automatically,
> what if you want to switch to it again?
>
>
>
> On Tuesday, August 7, 2018 at 11:17:45 AM UTC-7, rajagopalan madasami
> wrote:
>>
>> >>Ah, this got lost in the business that is Watir General this week<<
>>
>> I didn't understand this line.
>>
>> I know it switched back but the window which has switched left for no
>> reason ? When it comes to block it obviously has to close the window which
>> has been opened and switched. If you are not using block then there is no
>> need and that's what intented because user wants to take control of when to
>> close but when using the block he is obviously expecting the switched
>> window to be closed when he returns back, otherwise it's opened for what?
>>
>> On Tue 7 Aug, 2018, 11:41 PM Titus Fortner, <titusf...@gmail.com> wrote:
>>
>>> Ah, this got lost in the business that is Watir General this week
>>>
>>> If you are using the block it will automatically switch back to the
>>> original window for you.
>>> I don't like using blocks for things like this, so I explicitly switch
>>> back using `#original_window`.
>>>
>>> Neither approach automatically closes a window, so if it isn't the side
>>> effect of another action, you'll need to do that explicitly.
>>>
>>>
>>>
>>> On Tuesday, August 7, 2018 at 11:00:40 AM UTC-7, rajagopalan madasami
>>> wrote:
>>>>
>>>> Hi here you forgot to reply my previous mail. When I use block when
>>>> switching to the window , it's automatically needs to close the window, eh?
>>>> Please see my previous mail as well.
>>>>
>>>> On Tue 7 Aug, 2018, 8:56 PM Titus Fortner, <titusf...@gmail.com> wrote:
>>>>
>>>>> Oh no, I gave the right code:
>>>>> https://stackoverflow.com/a/51666596/4072371
>>>>>
>>>>> Also, original_window is stored for you, you don't need to create it.
>>>>>
>>>>> b.select_list(id: 'selWeek').options.each do |option|
>>>>>   option.select
>>>>>   b.button(id: 'csbtnSearch').click(:control)
>>>>>   b.windows.last.use
>>>>>   p b.element(xpath: '//*[@id="form1"]/table/tbody/tr[1]/td[1]/a').text
>>>>>   b.window.close
>>>>>   b.original_window.use
>>>>> end
>>>>> On Tue, Aug 7, 2018 at 8:20 AM Titus Fortner <titusf...@gmail.com>
>>>>> wrote:
>>>>> >
>>>>> > Gah, I mixed in Selenium code.
>>>>> >
>>>>> > In Selenium `driver.close` closes the window, and `driver.quit` ends
>>>>> > the session.
>>>>> > In Watir it needs to be `b.window.close`
>>>>> >
>>>>> > Let me find the SO entry to fix it.
>>>>> > On Tue, Aug 7, 2018 at 4:05 AM <rajagopal...@gmail.com> wrote:
>>>>> > >
>>>>> > > Hi Titus,
>>>>> > >
>>>>> > > We have recently had the talk in Stackoverflow, where you have
>>>>> suggested me this code
>>>>> > >
>>>>> > > I tried using your code but when I reach b.close, it's closing the
>>>>> browser totally not the tab which has opened recently so I couldn't 
>>>>> connect
>>>>> to the original window.
>>>>> > >
>>>>> > > Please execute this code
>>>>> > >
>>>>> > >> require 'watir'
>>>>> > >> driver = Selenium::WebDriver.for :chrome
>>>>> > >> b = Watir::Browser.new driver
>>>>> > >>
>>>>> > >> b.goto '
>>>>> https://services.wiltshire.gov.uk/PlanningGIS/LLPG/WeeklyList'
>>>>> > >>
>>>>> > >> b.select_list(id: 'selWeek').options.each do |option|
>>>>> > >> option.select
>>>>> > >> b.button(id: 'csbtnSearch').click(:control)
>>>>> > >> original = b.original_window
>>>>> > >> b.windows.last.use
>>>>> > >> p b.element(xpath:
>>>>> '//*[@id="form1"]/table/tbody/tr[1]/td[1]/a').text
>>>>> > >> b.close
>>>>> > >> b.original_window = original
>>>>> > >> end
>>>>> > >
>>>>> > >
>>>>> > >
>>>>> > > browser b.close is closing the browser not the newly opened tab so
>>>>> I couldn't connect to the original window and this throws the error. Is it
>>>>> a bug?
>>>>> > >
>>>>> > > --
>>>>> > > --
>>>>> > > Before posting, please read
>>>>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group
>>>>> .
>>>>> > > In short: search before you ask, be nice.
>>>>> > >
>>>>> > > watir-...@googlegroups.com
>>>>> > > http://groups.google.com/group/watir-general
>>>>> > > watir-genera...@googlegroups.com
>>>>> > > ---
>>>>> > > You received this message because you are subscribed to the Google
>>>>> Groups "Watir General" group.
>>>>> > > To unsubscribe from this group and stop receiving emails from it,
>>>>> send an email to watir-genera...@googlegroups.com.
>>>>> > > For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>> --
>>>>> --
>>>>> Before posting, please read
>>>>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>>>>
>>>>> In short: search before you ask, be nice.
>>>>>
>>>>> watir-...@googlegroups.com
>>>>> http://groups.google.com/group/watir-general
>>>>> watir-genera...@googlegroups.com
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Watir General" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to watir-genera...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>> --
>>> Before posting, please read
>>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>>>
>>> In short: search before you ask, be nice.
>>>
>>> watir-...@googlegroups.com
>>> http://groups.google.com/group/watir-general
>>> watir-genera...@googlegroups.com
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Watir General" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to watir-genera...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> --
> Before posting, please read
> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
>
> In short: search before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
> ---
> You received this message because you are subscribed to the Google Groups
> "Watir General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to watir-general+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
In short: search before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to