[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

I want to automate this text field.

Asha Latha

4/29/2009 4:21:00 AM

Hi

I want to automate this text field.

ie.text_field(:name, "JMSText").set('TEST').

Instead of TEST i want to copy content from text file and paste it in
text filed.

if i change the text in notepad ..it shoudl take the new value

Pleae help regarding this


Regards
Asha
--
Posted via http://www.ruby-....

4 Answers

Suraj Kurapati

4/29/2009 4:38:00 AM

0

Asha Latha wrote:
> ie.text_field(:name, "JMSText").set('TEST').
>
> Instead of TEST i want to copy content from text file and paste it in
> text filed.

Use the File::read() method:

file_path = "path to your file.txt"

file_contents = File.read(file_path)

ie.text_field(:name, "JMSText").set(file_contents)

> if i change the text in notepad ..it shoudl take the new value

With the above approach, you must rerun your Ruby program after changing
the text in notepad.

If you wish to have your Ruby program respond to changes in the text
file while it is still running, then take a look at libinotify.
--
Posted via http://www.ruby-....

Asha Latha

4/29/2009 5:38:00 AM

0

Hi

Thanks its working.

But i want to read first line and then paste that one to text filed,
once it is done i will read second line and so on....

Please help me to solve this.

Regards
Asha


Suraj Kurapati wrote:
> Asha Latha wrote:
>> ie.text_field(:name, "JMSText").set('TEST').
>>
>> Instead of TEST i want to copy content from text file and paste it in
>> text filed.
>
> Use the File::read() method:
>
> file_path = "path to your file.txt"
>
> file_contents = File.read(file_path)
>
> ie.text_field(:name, "JMSText").set(file_contents)
>
>> if i change the text in notepad ..it shoudl take the new value
>
> With the above approach, you must rerun your Ruby program after changing
> the text in notepad.
>
> If you wish to have your Ruby program respond to changes in the text
> file while it is still running, then take a look at libinotify.

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

7stud --

4/29/2009 6:16:00 AM

0

Asha Latha wrote:
> Hi
>
> Thanks its working.
>
> But i want to read first line and then paste that one to text filed,
> once it is done i will read second line and so on....
>
> Please help me to solve this.
>
> Regards
> Asha
>
>

IO.foreach("file_name") do |line|
...stuff here
end
--
Posted via http://www.ruby-....