On Mon, Mar 7, 2011 at 12:04 PM, Mattias Karlsson
<[email protected]> wrote:
>
> 1)
>  returned = @browser.alert do
>    @browser.goto('http://
> www.url.com/"+void(document.cookie="authorization=true")+alert(document.cookie)+"')
>   end
>
>   returned.should == "ok"
> # Doing positive test first
>
> but it doesn't find the alert box when it is displayed, and it is not
> working when I am setting the URL outside the block as well.
>

That's correct. If you look at the Browser#alert implementation, we
overwrite the window.alert function, and that will be gone when a new
page is loaded. This approach only works when the page doesn't change
inside the block.

> 2)
> Option two, however, does work, but only for firefox, and I would want
> it to work for all browsers with watir-webdriver.
>

You'll have to stick to Firefox for this test until WebDriver
implements the API cross-browser - it's a work in progress. You can
watch the status of this issue to follow its progress:

  http://code.google.com/p/selenium/issues/detail?id=27

Jari

-- 
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