Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20755

Alternative for Storages object in Script Extention that doesn't support Storages object

$
0
0

Hi,

Below is my function that uses Storages object in Test complete. I tried putting the same code in Script extension. But got the error message 'Object required'. because Script extension doesn't support Storages object.

can any one please give me equivalent vb script code for the same?

 

sSecName = "LanguageList"

sArrSubSec = "English"

sOptionName = "ShortDateFormat"

sXMLFile = "D:\Arun\ScrExtProjectSuite\Stores\Test Data\TestData_TestAutomation2.xml"

Function FetchValueFromXML(sXMLFile,sSecName,sArrSubSec, sOptionName) 

Note: This function returns Value of an Option of a Section/subsection in XML

'Variables

Dim sSubSec,arrSubSec 

'Read the data from XML file

Set FileSection =Storages.XML(sXMLFile)

Set sSection = FileSection.GetSubSection(sSecName) 

'Subsections are separated by "#"

arrSubSec= split(sArrSubSec,"#")

' log.Message arrSubSec(0)& arrSubSec(1) 

'Traverse subsection hierarchy and get the expected Section

For i = 0 toUBound(arrSubSec)

if arrSubSec(i) <> "" then 

'arrSubSec(i) <> Null AND

Set sSubSec= sSection.GetSubSection(arrSubSec(i))

Set sSection= sSubSec

EndIf

Next

 

'Get the Value of the Option in sub section

If sSubSec.OptionExists(sOptionName) Then

sVal = Trim(sSubSec.GetOption(sOptionName, Null))

FetchValueFromXML= sVal

Else

FetchValueFromXML= Null

EndIf

EndFunction

 

html file is attached along


Viewing all articles
Browse latest Browse all 20755

Trending Articles