Thank you for your response.
And I'm sorry for my poor description.
my code is follows:
1) $HIDE_IE = true
2) @ie = Watir::IE.new
3) @ie.button(:name, 'button1').click
where @ie.button(:name, 'button1') has an attribute of onclick whose value is
for submit a form.
Additionally the form tag has an attribute of target whose value is '_blank'
and an attribute of action whose value is next_url(this is some url).
So, after step 3), new window is popped up.
next,
4) @ie2 = Watir::IE.attach(:url, next_url)
my problem is thet
new windows popped up is shown in spite of $HIDE_IE = true.
But I found one answer executing a javascript before button is clicked.
The javascript replaces the value of the attribute of target in the
form tag from '_blank' to '_top'.
Ruby code is follows:
ie.execute_script(%{
(function() {
var forms = document.forms;
for (var i = 0; i < forms.length; i++) {
forms[i].setAttribute('target', '_top');
}
})();
})
It wokrs fine.
But please tell me other solution if you have cool one.
Thank you in advance.
2012/2/4 Abe Heward <[email protected]>:
> Last question:
>
> What happens when you add the line:
>
> browser2.close
>
> ...to your script? Or do you want the window to stay open, but hidden?
>
> Basically, it would help if you provided more detail. :-)
>
> --
> 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]
--
若山 剛
[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]