I have a pretty simple file upload page that I'm trying to test using Watir,
but I'm having difficulty figuring out how to actually enter the filename in
the field. I'm probably overlooking something absurdly simple.

 

Using irb, I was able to get the element (or at least elements in the
neighborhood) to flash with either of:

 

ie.table(:index, 3)[5][2].flash

ie.form(:id, 'uploadForm').flash

 

I was expecting ie.table(:index, 3)[5][2].text_field(:name,
'file').set('some_filename') to work, but it doesn't. I've tried a variety
of other things, but haven't hit on the right thing. What am I doing wrong?

 

Thanks in advance!

 

Joe

 

 

 

 

ie.show_all_objects includes the following:

 

hidden            name=formName       id=                 value=uploadForm
al

t=                src=

file              name=file           id=file             value=
al

t=                src=

 

 

Here's the HTML:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

            <HTML>

            <HEAD>

            <TITLE>Some title</TITLE>

    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <META http-equiv="Content-Script-Type" content="text/javascript">

    <META http-equiv="Pragma" content"no-cache">

    <META http-equiv="Expires" content"-1">

    <META name="cache-control" content="no-store">

    <META name="revisit-after" content="14 days">

    <META name="rating" content="Safe For Kids">

    <META name="copyright" content="2000-2005">

    <LINK rel="stylesheet" type="text/css"
href="/include/connect/style.css">

    <SCRIPT language="javascript"
src="/include/javascript/common.js"></SCRIPT>

    <SCRIPT language="javascript"
src="/include/javascript/calendar/calendar2.js"></SCRIPT>

            </HEAD>

            <BODY onload="javascript: if ('Navigator' == navigator.appName
&& document.forms.length > 0) document.forms[0].reset();">

            <TABLE cellspacing="0" cellpadding="0"
width="100%"><TBODY><TR><TD align="center">

            <TABLE class="page"><TBODY><TR><TD class="page">

            <DIV class="banner"></DIV>

                        <DIV class="menu"><DIV class="menu1">

 
&nbsp;<A id="plan" class="menu1" href="/plan/Summary.vm">plan</A>&nbsp;

 
&nbsp;<A id="firstid" class="menu1sel" href="/home.vm">firstid</A>&nbsp;

 
&nbsp;<A id="l&d" class="menu1" href="/plan/L.vm">l&d</A>&nbsp;

 
&nbsp;<A id="r" class="menu1" href="/ments.vm">r</A>&nbsp;

 
&nbsp;<A id="d" class="menu1" href="/D.vm">d</A>&nbsp;

 
&nbsp;<A id="p" class="menu1" href="/Info.vm">p</A>&nbsp;

 
&nbsp;<A id="contact us" class="menu1" href="/contact.vm">contact
us</A>&nbsp;

 
&nbsp;<A id="logout" class="menu1" href="/logout.vm">logout</A>&nbsp;

                                    </DIV><DIV class="menu2">

 
&nbsp;<A id="home&nbsp;page" class="menu2"
href="/home.vm">home&nbsp;page</A>&nbsp;

 
&nbsp;<A id="y" class="menu2sel" href="/staging.vm">y</A>&nbsp;

 
&nbsp;<A id="lots" class="menu2" href="/lots.vm">lots</A>&nbsp;

 
&nbsp;<A id="history" class="menu2" href="/history.vm">history</A>&nbsp;

 
&nbsp;<A id="story" class="menu2" href="/story.vm">story</A>&nbsp;

 
&nbsp;<A id="sharing" class="menu2" href="/sharing.vm">sharing</A>&nbsp;

 
&nbsp;<A id="counts" class="menu2" href="/counts.vm">counts</A>&nbsp;

 
&nbsp;<A id="groups" class="menu2" href="/groups.vm">roups</A>&nbsp;

 
</DIV></DIV>

                                                <DIV class="right"><SMALL
class="primary">Login: bob</SMALL></DIV>

                                                <DIV align="left"
class="title" id="stdTitle">Bob</DIV>

                                                <DIV align="left"
class="subtitle" id="stdSubtitle">Step 2</DIV>

                        </TD></TR><TR><TD class="page"> 

            

<HR>

<FORM id="uploadForm" encType="multipart/form-data" name="uploadForm"
method="post">

<INPUT type="hidden" name="formName" value="uploadForm">

<INPUT type="hidden" name="someId" value="ur334891323">

<TABLE class="form" width="100%"><TBODY>

<TR class="form"><TD align="left" valign="top" colspan="2"
class="form"><TABLE class="stepTable" width="100%" cellspacing="2px"
cellpadding="0"><TBODY>

<TR class="stepRow"><TD align="center" valign="middle" width="25%"
class="stepCompleted"><IMG id="image1" tabindex="1"
src="/include/image/c16.gif" name="image1" readonly>&nbsp;<B>Step
1.</B></TD><TD align="center" valign="middle" width="25%"
class="stepCurrent">&nbsp;<B>Step 2</B></TD><TD align="center"
valign="middle" width="25%" class="stepDisabled">&nbsp;<B>Step 3</B></TD><TD
align="center" valign="middle" width="25%"
class="stepDisabled">&nbsp;<B>Step 4</B></TD></TR>

</TBODY></TABLE>

</TD></TR>

<TR class="form"><TD align="left" valign="top" colspan="2"
class="form"><HR></TD></TR>

<TR class="form"><TD align="left" valign="top" colspan="2" class="form"><P
id="paragraph21" tabindex="1">Enter (or <b>'Browse'</b>) the name of your
file and click <b>'Next Step'</b> to continue.</P></TD></TR>

<TR class="form"><TD align="left" valign="top" colspan="2" class="form"><HR
class="thin"></TD></TR>

<TR class="form"><TD align="left" valign="top" width="30%"
class="form"><B>Contribution File:</B></TD><TD align="left" valign="top"
width="70%" class="form"><INPUT id="file" tabindex="1" maxLength="128"
value="[enter or browse a filename]" type="file" size="80"
name="file"></TD></TR>

</TBODY></TABLE>

 

<HR>

<DIV align="right">

<INPUT id="cancel" tabindex="1" value="Cancel" type="button"
class="wideButton" onclick="javascript: location.href =
'/contribution/home.vm';" name="cancel">&nbsp;<INPUT id="submit"
tabindex="1" value="Save & Finish Later" type="submit" class="wideButton"
name="submit">&nbsp;<INPUT id="prevStep" tabindex="1" value="Previous Step"
type="submit" class="wideButton" name="prevStep">&nbsp;<INPUT id="nextStep"
tabindex="1" value="Next Step" type="submit" class="wideButton"
name="nextStep">

</DIV>

<HR>

</FORM>

 

 

                                                </TD></TR><TR><TD
class="page"> 

            <DIV>&nbsp;</DIV>

            <DIV class="footer" width="100%">

    <A id="footerSupport" target="_blank" href="mailto:[EMAIL PROTECTED]"
class="footer">Help</A>&nbsp;&nbsp;

    <A id="footerInfo" target="_blank" href="mailto:[EMAIL PROTECTED]"
class="footer">Information</A>&nbsp;&nbsp;

    <A id="footerAdmin" target="_blank" href="mailto:[EMAIL PROTECTED]
class="footer">Administration</A>&nbsp;&nbsp;

    <A id="footerSales" target="_blank" href="mailto:[EMAIL PROTECTED]"
class="footer">Sales</A>&nbsp;&nbsp;

    <A id="footerPrivacy" href="/common/privacy.vm"
class="footer">Privacy</A><BR>

            <SMALL class="italic">Copyright &copy; 2000-2005</SMALL>

            </DIV> 

            </TD></TR></TBODY></TABLE>

            </TD></TR></TBODY></TABLE>

                        </BODY>

    <HEAD>

    <META http-equiv="Pragma" CONTENT="no-cache">

    <META http-equiv="Expires" CONTENT="-1">

    <META name="cache-control" content="no-store">

    </HEAD>

            </HTML>




_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to