put textsearch.html to
1-25/25
puts
pagecontainstext_test.rb
def test_match_regexp_found2
$~ = $ie.contains_text(/\/25/)
assert_equal('/25', $&)
end
def test_match_regexp_found3
$~ = $ie.contains_text(/(\/25)/)
assert_equal('/25', $1)
end
thes
At 09:44 AM 9/13/2005, Atilla Ozgur wrote:
parantheses gives you what is matched. for example you have something like
this.
(\d\d)-(\d) if this expression matches to 25-1
$1 gives you 25, $2 gives you 1. Since you have not parantheses in
your regular expression, ruby gives you nil. You find that
erprets and computes 1-25/25
> as nil instead?
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bret Pettichord
> Sent: Tuesday, September 13, 2005 12:34 PM
> To: wtr-general@rubyforge.org
> Subject: RE: [Wtr-general] check what'
September 13, 2005 12:34 PM
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] check what's the content of this certain text
At 10:14 PM 9/12/2005, [EMAIL PROTECTED] wrote:
>hi I used this...
>
>if $ie.contains_text("/25") then puts $& end
>
>but it return
At 10:14 PM 9/12/2005, [EMAIL PROTECTED] wrote:
hi I used this...
if $ie.contains_text("/25") then puts $& end
but it returns nil. don't know why. I'm assuming it will return /25 or
rather the whole text.
You have to use a regular expression:
$ie.contains_text(/\/25/); puts $&
(You have
nday, September 12, 2005 11:34 PM
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] check what's the content of this certain text
After calling ie.contains_text(), check the value of $& -- it'll be the
value that was matched.
Bret
At 06:45 AM 9/12/2005, [EMAIL PROTECTED] wro
oh I see. Thanks a lot!
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Bret Pettichord
Sent: Monday, September 12, 2005 11:34 PM
To: wtr-general@rubyforge.org
Subject: RE: [Wtr-general] check what's the content of this certain text
After ca
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Atilla Ozgur
Sent: Monday, September 12, 2005 7:21 PM
To: wtr-general@rubyforge.org
Subject: Re: [Wtr-general] check what's the content of this certain text
try regular expressions?
\d-\d\\\d
\d matches digits.
assert($ie.contai
-general] check what's the content of this certain text
try regular expressions?
\d-\d\\\d
\d matches digits.
assert($ie.contains_text(/\d-\d\\\d/))
this should match 1-1\1 to 9-9\9 but if you reports will have more
than one digit, you should use.
\d\d to match two digits.
Hope it wi
try regular expressions?
\d-\d\\\d
\d matches digits.
assert($ie.contains_text(/\d-\d\\\d/))
this should match 1-1\1 to 9-9\9 but if you reports will have more
than one digit, you should use.
\d\d to match two digits.
Hope it will be usefull.
On 9/12/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
attached is the source of the webpage I want to test. I need to check a certain
text in this area. in this example... particularly the "1-1/1" string. and
that's dynamic depending on the number of reports returned. It could be 1-3/3,
etc... What's the best way in doing this? Thanks.
<>
-Ja
11 matches
Mail list logo