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 <[email protected]> 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.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
> ---
> 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 [email protected].
> 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.

[email protected]
http://groups.google.com/group/watir-general
[email protected]
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to