''Input Information - Workbook file Name with path ''WorkSheet Name '' Provide the sort criteria based on which data needs to be filtered seperated by | WorkBookFile = "C:\\testing.xls" SheetName = "testing" MultipleSortCriteria = "TestName|TestClass|TestPath" '' Define the constants to be used in the script Const xlYes = 1 Const xlAscending = 1 Const xlDescending = 2 Set oXL = CreateObject("Excel.Application") Set oWB = oXL.WorkBooks.Open(WorkBookFile) Set oWS = oWB.Worksheets(SheetName) Set oRnge = oWS.UsedRange ColCnt = oRnge.columns.count '' Create an array based on the sort criteria provided aSrtCriteria = split(MultipleSortCriteria,"|") For i = ubound(aSrtCriteria) to 0 step -1 ''Loop the times data needs to be sorted For j = 1 to ColCount step 1 If (oWS.cells(1,j).value =aSrtCriteria(i)) Then '' Sort the data based on the column name Set oRngeSrt = oXL.Range(Chr(asc("A")- 1+j) & "1") oRnge.Sort oRngeSrt, xlDescending, , , , , , xlYes oWB.save Exit For End If Next Next oWB.Close oXL.Quit Set oWB = Nothing Set oXL = Nothing
Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts
Sorting excel data multiple times based on column Name using VBScript
Labels:
Advanced QTP,
QTP,
VBScript,
VBScript Tutorials
VBScript Code to close the IE browsers and Internet Explorer not responding window
Labels:
Advanced QTP,
qtp Scripts,
UFT 11.5,
VBScript,
VBScript Tutorials
- VBScript Code to close the IE browsers and Internet Explorer not responding window
Set WShell = CreateObject("WScript.Shell") ''This will close all the instances of task iexplore.exe. ''Parameter /f kills the process forcefully WShell.Exec("taskkill /fi ""imagename eq iexplore.exe"" /f") WScript.Sleep 100
''At time Internet explorer is not responding error is displayed ''The task has window title as internet explorer not responding. ''We can close the task based on window title with regular expression as Internet * WShell.Exec("taskkill /fi ""WINDOWTITLE eq Internet*"" /f") WScript.Sleep 100
''Once the window is closed, another window appear with similar title
'' which needs to be closed WShell.Exec("taskkill /fi ""WINDOWTITLE eq Internet*"" /f")
- VBScript Code to save the list of running tasks and save it in file abc.txt
''Below command will return the service for the process and save it in file abc.txt
Set WShell = CreateObject("WScript.Shell")
''This will close all the instances of task iexplore.exe. ''Parameter /f kills the process forcefully
WShell.Exec("tasklist /fi /svc>test.txt")
ReConnecting to Remote sessions using group policy edit
In QTP/UFT automation suite execution,we may require to connect remotely to multiple machines through remote desktop connection for monitoring test execution, We may face issue in remote connection being disconnected due to network issues/remote sessions.
To allow smooth test execution, we should reconnect to the remote sessions in case of any network disconnect. In this post, I will share what we can do to reconnect remote connection in case of session disconnect due to network issues and failures.
- Using experience in Remote Desktop Connection
- Go to Run>mstsc
- In Remote Desktop connection window, Go to Experience Panel.
- Select checkbox "Reconnect if the connection is dropped"
By default, a maximum of twenty reconnection attempts are made at five second intervals.
- Defining Group policy for Remote Desktop connection
- Navigate to group policy for the machine
- Navigate to run> gpedit.msc
- Local group Policy editor Window is displayed.
- Click on Administrative Templates\Windows Components\Remote desktop Services\Remote Desktop Session Host\Connections
- Policy Settings
- Automatic Reconnection- If policy setting is enabled, automatic reconnection is attempted for all clients running Remote Desktop Connection whenever their network connection is lost.
- Configure keep-alive connection interval - This policy setting allows you to enter a keep-alive interval to ensure that the session state on the RD Session Host server is consistent with the client state. If you enable this policy setting, you must enter a keep-alive interval. The keep-alive interval determines how often, in minutes, the server checks the session state. The range of values you can enter is 1 to 999,999.
Subscribe to:
Posts (Atom)