-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Read your text from the text file:
textfile:
data1
data2
Inactive
data = File.readlines("textfile.txt")
$ie.select_list( :name ,"body:adminView:form3:lstStatus").select(data[2])
Line 1 of your text file is data1, ruby starts counting at 0 - so line 3
of your text file is
read into the array data at position 2
- ----
You can also do this with the datahandler.rb I mailed
You would put your data like this:
CheckBoxStatus
Inactive
require 'datahandler'
d = DataHandler.new("data.csv")
inactive = d.data[0].CheckBoxStatus
$ie.select_list( :name ,"body:adminView:form3:lstStatus").select(inactive)
Hope that helps
Thanks
Kingsley
>
> hello,
> thanks for replying . but i want to know
> 1>how data can be read into a variable.Incase i have a combo box which
> has values>>
> Active,Inactive,Suspended,Confirmed.
> If i have to hard code it then the code will look like this:
>
> $ie.select_list( :name
> ,"body:adminView:form3:lstStatus").select("Inactive")
>
> I have a .txt file from which am reading Inactive then how do i do
> it?
> my text looks like this
>
> /* exp.txt
> data1
> data2
> Inactive */
>
> i tried this:
> a=IO.readlines("exp.txt")
> i=a.length
> j=0
> loop do
> #read data 1...it is text field
> j++
> #read data 2...it is text field
> j++
> c=a.gets
> j++
> c=a[j]
> $ie.select_list( :name
> ,"body:adminView:form3:lstStatus").select(c)
> break if j>= i
> end
> i get this error
>
> 1) Error:
> test_print_assertion(TC_qual_assert):
> Watir::Exception::NoValueFoundException: No option with text of Inactive
> in this select element
>
>
> 2> if doing the above isnt possible then i want to know how it can be read
> from a csv and then broken into diff fields and read separately
> eg:
> data1,data2,Inactive-------is my csv
> 3> give me the code for dealing with javascript alert boxes
>
> plz reply as soon as possible am stuck up here and cant seem to continue
> Regards,
>
> Nishita Acharya
> Bangalore.
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFDDzb8Z8AEccynd5gRAmvcAJ0Yr5hMcbV1py6UwXnpjD5i+83BSQCgnU61
Wfu2bpscXn5VBj8j27Ucmfk=
=5GQb
-----END PGP SIGNATURE-----
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general