Unfortunately is looks like with the latest Selenium, opening windows
and accessing them through the framework is not stable.
Basically what is happening is that Selenium overrides the browser's
window.open method and all browsers now get upset when you do that and
end up causing unexpected results. It used to be specific to Safari
but that's no longer the case. Selenium 2 can circumvent this issue by
leveraging its WebDriver component, but to do that will mean having to
do a major refactor of Lebowski since the original Selenium and
WebDriver have very different architectures. It's something I want to
do but haven't had the time as of yet.
One part that is still semi-functional is if you open a window and
provide it an explicit identifier, like so:
var win = window.open('some/url', 'foo', ...);
With 'foo' as the ID of the opened window, you can then access it with
Lebowski like so:
windows = App.opened_windows
win = windows.find_by_name "foo"
win.should_not be_nil
win.should be_opened
# ... do some stuff
win.close
There's one catch: While this works in Firefox, Safari and such, if
you do this operation more than once you end up getting unexpected
results.
I'll spend some time seeing if there's anything i can do to make this
work as expected, but unfortunately this is more to do with Selenium
and browsers just not liking it when you override window.open().
-Mike
On Sep 14, 8:06 am, Кирилл Ширинкин <
fodoj...@gmail.com> wrote:
> Seems like facebook window is not recognized by OpenedIWindows method.
> This is my test:
> it "should be able to login" do
> loginButton = App['loginButton', 'SC.View']
> loginButton.click
>
> facebook = App.opened_windows
> sleep 30
> #.find_by_title("Log In | Facebook")
>
> facebook.should eql 2
> end
>
> So App.opened_windows returns this:
http://pastie.org/2532228
>
> I can't see anything related to facebook.
> Also App.opened_windows.find_by_title("Log In | Facebook") returns nil
> (title is correct).
>
> 2011/9/13 Кирилл Ширинкин <
fodoj...@gmail.com>
>
>
>
>
>
>
>
>
>
> > Biggest thanks, i already started thinking that it's impossible to fill in
> > info on facebook window. Good to hear that i was wrong :)
>
> > 2011/9/13 MikeC <
michael.lee.co...@gmail.com>