A useful general principle if you are wondering if something will work  
is to try it. In Ruby, start IRB (type irb at the command line) then  
type your ruby code. Irb will show you the results after each line.  
You do not need $ signs (ruby global variable) but you must certainly  
quote your strings. However your code will not work as there is no -  
method for a string.

Instead, you could use the sub or gsub methods:

a = "aba"
a.gsub 'a', 'c'
=> "cbc"

In the simple case, it sounds like you want to use a regular  
expression (regexp) to do pattern recognition. Results of matching are  
stores in MatchData objects. Something like:

re = /<pattern>(.*)<\pattern/>/
matchdata = string.match(re)
puts matchdata.captures

However, if you want to do more than this you would be better using  
REXML  as Richard suggested. Alternatively, use a tool designed for  
testing XML webservices eg SOAPUI. Watir is designed for testing  
websites.

You might want to read a ruby tutorial though to get a better idea of  
how to use ruby.

Hope this helps.

On 4 Dec 2008, at 06:40, winstan <[EMAIL PROTECTED]> wrote:

>
> Would i be able to do some thing like this:
>
> $a = <ShortName>TESTA</ShortName>
> $b = <ShortName>
> $c = </ShortName>
> $d = a - b
> $e = d - c
>
> which in turn would make $e "TESTA"?
>
>
>
> On Dec 4, 4:55 pm, "Richard Lawrence" <[EMAIL PROTECTED]> wrote:
>> Why are you accessing the web service using Watir and IE? Will end
>> users of the web service access it with a browser? If not, and if
>> you're just using the web service to get data to use in other GUI
>> tests, you might find something like Net::Http and REXML to be more
>> appropriate for this part of your script.
>>
>> Richard
>>
>> --
>> Richard Lawrence
>> Certified Scrum Coach
>> Founder and Principal Consultant, Humanizing Work, LLC
>> 303-895-7688
>> [EMAIL PROTECTED]
>>
>>
>>
>> On Wed, Dec 3, 2008 at 9:29 PM, winstan  
>> <[EMAIL PROTECTED]> wrote:
>>
>>> Hi all,
>>
>>> I'm trying to capture a variety of data in an xml response from a  
>>> web
>>> service, that is served up via IE and the GUI, however when I
>>> interrogate the data using the IE dev toolbar I notice that all the
>>> element properties render useless as they are all of the same nature
>>> and properties.
>>
>>> Bellow is an extract from an example xml response in which I want to
>>> capture the given Shortname and Long name (TestA) and set them as
>>> variables for use later in the script when accessing another system
>>> and validating the data between the two GUI's.
>>
>>> <ShortName>TESTA</ShortName>
>>> <LongName>TestA</LongName>
>>
>>> I hope the information provided is sufficient and understandable.
>>
>>> Thanks again- Hide quoted text -
>>
>> - Show quoted text -
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to