FireWatir: numeric values into text field

V

Void

Hello,


I'm new to Ruby and into di ng, but I hope to find a solution to the problem
I'm facing. I need to make a quick script to put some values into some text
fileds in a web page. This should be simple:

[...]
$ff=Firefox.new
[...]
$ff.form:)name,"page2").text_field:)name,"dd1").set(start_date.day.to_s)
[...]

BUT: there is a javascript check in the web page that raise an alert if the
key pressed is not numeric:

function onKeyNumeric(e) {
if ( ((e.keyCode >= 48) && (e.keyCode <= 57)) ||
((e.keyCode >= 35) && (e.keyCode <= 40)) ||
((e.keyCode >= 45) && (e.keyCode <= 46)) ||
((e.keyCode >= 08) && (e.keyCode <= 09)) ||
(e.keyCode >= 12) ) {
return true;
} else {
alert ("Numeric only values accepted.");
return false;
}
}

I tried to set a "start_date.day.to_i", but I got an error such as only
string values could be put in.

Any ideas?


By the way, what does the following line mean? I don't understand its
syntax:

request = /javascript:sel.'#{links[index]}','/


Bye,
Void
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top