Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split a String
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
I am facing another problem with Split now.

I have captured the text = " Frankfurt TO New York"
the text come from run time datatable.
text= datatable.Value("Select_a_Flight_MercuryOutput_Text_out",dtglobalsheet)
I used following split function
Code:
Myarr=split(text,"TO")
msgbox Myarr(0)
msgbox  Myarr(1)

Here Myarr(0) displayed the value as Frankfurt TO New York ?
and Myarr(1) displayed following error.

The test run cannot continue due to an unrecoverable error.

Subscript out of range: '[number: 1]'

Line (16): "msgbox Myarr(1)".

Please find the below code
---------------------------------------------------------------------------------
Code:
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "mercury"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "4d136083f7eb3294cfee0f9766e331cd0c781dde"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 34,13
For i=1 to Datatable.GetRowCount
datatable.SetCurrentRow(i)
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").Select DataTable("p_Item", dtGlobalSheet)
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toPort").Select DataTable("p_Item1", dtGlobalSheet)
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Image("findFlights").Click 57,16
'Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebElement("Frankfurt to New York").Output CheckPoint("Frankfurt to New York")
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Output CheckPoint("Select a Flight: Mercury Tours")
text= datatable.Value("Select_a_Flight_MercuryOutput_Text_out",dtglobalsheet)
msgbox text
Dim a,b,text
Myarr=split(text,"TO")
msgbox Myarr(0)
msgbox  Myarr(1)
Browser("Welcome: Mercury Tours").Back
Next
Reply


Messages In This Thread
Split a String - by sudhirzpatil - 12-23-2010, 07:26 PM
RE: Split a String - by sudhirzpatil - 12-23-2010, 09:39 PM
RE: Split a String - by manishbhalshankar - 12-24-2010, 10:03 AM
RE: Split a String - by sudhirzpatil - 12-24-2010, 11:10 AM
RE: Split a String - by manishbhalshankar - 12-24-2010, 11:20 AM
RE: Split a String - by sudhirzpatil - 12-24-2010, 11:37 AM
RE: Split a String - by sudhirzpatil - 12-26-2010, 09:39 AM
RE: Split a String - by UFTEnthusiast - 01-04-2011, 07:12 PM
RE: Split a String - by sreekanth chilam - 01-04-2011, 11:22 PM
RE: Split a String - by UFTEnthusiast - 01-05-2011, 03:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Split function in string nidhishnair 13 64,749 07-07-2020, 03:47 PM
Last Post: helmzshelmz
Question Split Function Chaithra N 0 1,182 12-18-2019, 11:33 AM
Last Post: Chaithra N
  Split a string with multiple delimiters in VBScript nandha 2 8,668 02-10-2018, 06:44 PM
Last Post: nandha
  Replace a string in a word document with another string rekha.naik 8 15,583 11-14-2013, 12:58 PM
Last Post: pranikgarg
  Split Function diya 2 5,798 11-28-2012, 08:49 PM
Last Post: diya

Forum Jump:


Users browsing this thread: 7 Guest(s)