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

Key: WET-239
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
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 containing return character, backslash (\) & double quote (") are NOT properly prefixed with proper escape characters

Created: 19/Sep/06 12:40 AM   Updated: 09/Jul/07 02:01 AM
Component/s: Script Assistant
Affects Version/s: 0.9.8 Final
Fix Version/s: 1.0.0, 0.9.8_Patch

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Issue Links:
Relationship
This issue Relates to:
WET-290 Properties of web pages should be esc... Major Closed
 


 Description  « Hide
Use the following HTML code and paste it in a HTML file (say "a.htm")

<HTML>
 <HEAD>
  <TITLE>
   WET Test
  </TITLE>
 </HEAD>
<input id="CheckBox1" type="checkbox"/>
<label for="CheckBox1">Check'Box\<br />"Text"\n\n</label></td>
</HTML>

Open the html file (a.htm) in Internet Explorer.

Open the WET UI.
Navigate to the Menu Item "View" -> "Sync with Browser" -> "WET Test".
Open the Simulated Browser.
Right click on the check-box and in the menu popup, select "Full Definition View".
Right click on the check-box again and select the item "set" from the menu popup.
Observe the line (in fact two lines are inserted) that is inserted in the WET Editor.
Browser("title:=WET Test").Checkbox("label:=Check'Box\
"Text"\n\n").set()

The above line of scirpt will fail exeucution, since it is syntactically incorrect, with the following error message.
c.rb:5: parse error, unexpected tCONSTANT, expecting ')'
"Text"\n\n").set()
     ^
c.rb:5: parse error, unexpected ')', expecting $
"Text"\n\n").set()

Expected Behaviour:
           The correct line should have been as given below:
Browser("title:=WET Test").Checkbox("label:=Check'Box\\\r\n\"Text\"\\n\\n").set
Executing the above line, will put a "check" mark in the check box, and thus runs successfully.

Note: The above line is obtained, through the Script Assistant Utility Ver 0.1. The validations related to return character, backslash (\) & double quote (") are taken care in the "BrowserPatrol.rb" file, in the "BuildProperty" function. Refer to that and make necessary changes in the present utilty also. The relevant script lines are given below.

propertyValue = propertyValue.gsub(/\\/, "\\\\\\")
propertyValue = propertyValue.gsub("\"", "\\\"")
propertyValue = propertyValue.gsub(/\r/, "\\r")
propertyValue = propertyValue.gsub(/\n/, "\\n")

 All   Comments   Work Log   Change History      Sort Order:
Raghu Venkataramana - 29/Sep/06 04:35 PM
The chances that we run into this is quite rare. On those occassions, the scripts can be changed by hand

Venugopal S Shenoy - 04/Oct/06 10:11 AM
Tried the WET UI on the page "http://www.wet.qantom.org/home.html" and got the following description about the button object.

Browser("title:=Commercial grade Opensource Web automation testing tool").Button("value:=<SPAN style="COLOR: #000099">Home</SPAN>").click()

which is syntactically wrong, since a double quote appears just before "COLOR" and just before ">Home<" and the proper escape sequence of putting backslash before the extra double quote is not present.

I have logged the above bug basically from two persceptives, while the WET user starts using WET UI for scripting

(a) While using the WET UI extensively, during scripting, there are chances, that script developer just right clicks on the web object which has either of the above characters (return character, double quote or backslash) and finds only at the end about the syntax error, when either the script is opened in an editor like SciTE which highlights about the wrong syntax or while trying to compile or run the scirpt.

(b) With the introduction of WET UI, more novice users of Ruby language will start using WET and few may not be in a position to understand and correct the syntax. Their presumtion would be that the script lines generated by the WET UI utility is syntactically correct, which in the present case is NOT guaranteed.

In the light of the above, I think the above bug should be addressed in 0.9.8 Patch.

Raghu Venkataramana - 04/Oct/06 01:52 PM
Fixed in Rev. 411 and 412

Had to encode the string and also make some changes to the function dialog. I haven't done a lot of testing on this.

Raghu Venkataramana - 02/Apr/07 10:51 PM
Release Notes