History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WET-163
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Venugopal S Shenoy
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WET

Labels mentioned within the <span> & </span> are not associated with the TextField, Textarea & File Controls

Created: 14/Aug/06 03:26 AM   Updated: 18/Jun/07 10:31 AM
Component/s: Native watir object model
Affects Version/s: 0.9.8_beta1
Fix Version/s: Future

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Use the following html, to run the ruby script given below:

<head>
<title>
WET Test
</title>
</head>

<body>
        <span>Text Box Label:</span>&nbsp;&nbsp;&nbsp;
        <input type="text"/>

</br></br></br>
        <span>Text Area Label:</span>&nbsp;&nbsp;&nbsp;
        <textarea></textarea>

</br></br></br>
         <span>File Label:</span>&nbsp;&nbsp;&nbsp;
         <input type="file"/>

</br></br></br>
        Text Box Label:&nbsp;&nbsp;&nbsp;
        <input type="text"/>

</br></br></br>
        Text Area Label:&nbsp;&nbsp;&nbsp;
        <textarea></textarea>

</br></br></br>
        File Label:&nbsp;&nbsp;&nbsp;
        <input type="file"/>
</body>

################## Ruby Script ##################
puts Browser("title:=WET Test").TextField("index:=1").label
puts Browser("title:=WET Test").Textarea("index:=1").label
puts Browser("title:=WET Test").File("index:=1").label

puts Browser("title:=WET Test").TextField("index:=2").label
puts Browser("title:=WET Test").Textarea("index:=2").label
puts Browser("title:=WET Test").File("index:=2").label
###############################################

#################### Results ##################
>ruby Test.rb



Text Box Label:
Text Area Label:
File Label:
>Exit code: 0
###############################################

When the labels are kept within the <span> & </span> then they are NOT associated with the Textarea, TextField & File Controls. {For the index:=1, the label returned is empty string, since the label is kept within the <span> & </span>}

 All   Comments   Work Log   Change History      Sort Order:
Raghu Venkataramana - 15/Aug/06 09:50 AM
This is a tricky one to fix. Rather tricky one to tell wet how to find the label. Right now, when it comes to labels, a smart guess is made using the following algorithm:
1) If there is a html <label> element, with a labelfor associated with the textfield (or other input as the case may be), then this gets the first preference.
2) Otherwise, we try to determine the text immediately before this control .
3) If (3) is an empty string (or string with spaces), then WET tries to determine if the control is in a table. If yes, then the text in the column just before the control is treated as the label.

In the above case, it is going to be quite difficult for WET to determine whether the <span> element appears just before the textarea or not


Raghu Venkataramana - 18/Jun/07 10:13 AM
I am marking it as fix for future - simply because it is too difficult to tell what's a label and what's not!

Raghu Venkataramana - 18/Jun/07 10:30 AM
A duplicate issue WET-383 was written as:

For the text filed as below

<small>Small tag label</small><input type=text name="smallText"></input>

The definiton obtained should be :
Textfield("label"=>"small tag label" )

Obtained result :
Textfield("name"=>"smallText")

Raghu Venkataramana - 18/Jun/07 10:31 AM
A duplicate issue, WET-384 was written as:

For the text filed as below

<big>Small tag label</big><input type=text name="smallText"></input>

The definiton obtained should be :
Textfield("label"=>"small tag label" )

Obtained result :
Textfield("name"=>"smallText")