Question on watir

hi, thank you, I am using the version of 1.8.3 version, But if i use the
1.9.3,I am facing the problem gem installation, So i never go there.

RAJ

Am 14.03.2013 05:23, schrieb Raj pal:

hi, thank you, I am using the version of 1.8.3 version, But if i use the

Any support for 1.8.7 (like security fixes) will end this year.

1.9.3,I am facing the problem gem installation, So i never go there.

?

I have already in a project for automation,now all functions are working
in 1.8.7 ,So if i immediately changes to 1.9.7,I will be in need of
changing everything right?

RAJ

hi, I am comparing objects like

if a.class.to_s == ‘hash’
puts ‘hash’
end

Is there any way can i compare objects directly?

Like if a.class==OBJECT
puts ‘hash’
end

object.is_a?( Hash ) is the one I usually use.

By the way, this caught me out for a while. When using a case statement
to check classes, the syntax is a bit different from if statements:

case object
when Hash
end

On Mar 14, 2013 2:45 AM, “Raj pal” [email protected] wrote:

   puts 'hash'

end


Posted via http://www.ruby-forum.com/.

Not quite getting what you want, but would === or is_a? work?

hi I have a question about pop up, we can handle the pop up if it is the
part of the window. But Now I am automating another screen,here pop up
arises as new window, how can i handle this pop up? Is there any idea?

RAJ

This was already addressed in another thread:
http://www.ruby-forum.com/topic/4407617#new

Ok Thank you very much.

RAJ

hi Joel P.,

a="hi how are you

what are you doing"

b="hi how are you

what are you doing"

one=a
one=one.delete(’ ‘)
one=one.delete("\n")
puts one
two=b
two=two.delete(’ ')
two=two.delete("\n")
puts two

The above code is working perfectly, but while i take “hi how are you
what are you doing” from SCREEN to a variable one,this delete("\n") is
not working, can you guess where the problem is?

RAJ

yes it is working for me, this is what I want.And what is the difference
did you see while you were using for case statement.?

Thank you.
RAJ

Yes thank you, I realized that that character was 13 not 10.10 is for
enter key.That’s what it hasn’t been removed. Thanks anyway for this a =
a.gsub(/\s/,’’)code.

RAJ

Inspect the result you get from “SCREEN”. You may have different
characters in there.

By the way, if you really feel the urge to remove all whitespace, try
this:

a = a.gsub(/\s/,’’)

It means that 1.8.7 won’t receive any more updates, so you need to
upgrade to a newer Ruby version ASAP.
I’d reccommend testing for compatiblity on a test network (or test
computer for smaller-scale operations) before rolling out an update.

“Any support for 1.8.7 (like security fixes) will end this year.”

what do you meant by this line? I don’t understand what you meant by
support for 1.8.7 will end?

hi Joel P.,

You told me to refer the another discussion for popup, I used your code
here,

$browser.windows.each {|w| w.close rescue nil}
$browser.close rescue nil

But it is not closing the window as you told there.

My problem is, when i am pressing the next button one pop up is getting
opening in a new window.I used above code of yours, but it’s not
working.what should I do to handle that pop up? In the earlier case, pop
up was attached with browser window, so I used the developer tool to
find the id and i succeeded but I now I couldn’t use the developer tool
also.

And also I need to read the message on the pop up, Is it possible ? you
only have given the way to close the pop up.
RAJ

Ok thank you.

RAJ

hi I have used the below code,

puts $browser.windows.count
$browser.windows.each do |w|
puts w.title
w.close
end

but it is not closing the pop up. but it’s printing the title and count
also.I think w.close is not working. what can i do to solve this
problem?And also the pop consist of Ok button, can i press that OK
button?

I didn’t understand this message

$browser. (code to read the message here)

what you meant here? how would I write the code to read the pop message?

RAJ

When you say “popup” do you mean a Javascript Alert?

If so, in the latest versions of watir-webdriver I believe that’s as
easy as:
puts $browser.alert.text
$browser.alert.close

It helps to get some feedback using IRB:

puts $browser.windows.count

$browser.windows.each {|w| puts w.title }

#The last window should be your popup:
$browser.windows.last.use do
$browser. (code to read the message here)
end