If I'm reading this correctly, your issue is that the line of code:

ie.form(:id,'commonLoginform').text_field(:name,
'username').set'$user'

is incorrectly setting the name of the variable ($user) and not
the value held in that variable.  When you quoted "$user" it was
being defined as a String, not a variable.

Try this:

ie.form(:id,'commonLoginform').text_field(:name,
'username').set($user)

Joe

P.S.
Strongly recommend you look into using the Roo gem instead of dealing
with Excel with win32ole.
Roo has numerous benefits, such as not needing Excel installed to read
the spreadsheet, thus its also platform independent!
Just one if its benefits.

http://roo.rubyforge.org/

gem install roo


On Sep 14, 2:01 am, lifeng jiang <jiangsqu...@gmail.com> wrote:
> hi all:
>      I want to get values from excel,here is my code:
>
> ie.link(:text,"XXX").click
> ie.form(:id,'commonLoginform').text_field(:name,
> 'username').set'$user'
> ie.form(:id,'commonLoginform').button(:class,'btn').click
>
> it's my file Excel :
> jiangsquall
>
> I want to set a value(jiangsquall) to the text_field,but in fact,it
> set "$user" to the text_field.
> how to get the value(jiangsquall) which I want ?

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to