Please post your Web Driver questions in official Web Driver forum

Thursday, April 22, 2010

Mobile Theft in BMTC buses

 
Well, this is some thing I had heard of and was not expecting to experience.
I bought a brand new Nokia 5800 about 6 months ago and have fallen Victim of petty thieves in BMTC buses.
I got in to a non Volvo bus near Jayadeva flyover to head to Dairy Circle, IBC Park.
This is a mere distance of 2 km or so.
Bus was not very crowded and I was standing near front door as my destination was not very far.
I noticed a couple of guys who were also standing near me and I assumed that probably they also want to get down near by.
As soon as bus started one guy came behind me while two more guys quickly moved near closed bus door.
One guy in white shirt was standing next to me.
The guy who was behind me came forward and now there were three guys near closed door.
Bus stopped on next station and none of them got down nor were they willing to move and give space to incoming passengers.
Then was the next stop where I had to get down (and all this while I did not have an iota of impression about their objective). There were still three guys near exit door, so I asked them to move and give me space.
Though they did not bother to move, I tried to get down from remaining space and noticed some scuffle behind me (though I still did not bother to check my mobile and wallet).
This is when I got down from bus and saw a couple of guys getting in to another bus from the bus I was in.
At this point I realized not having my mobile with me, and was completely in shock to do any thing.
My intention of this blog is to make Bangalorean aware of such incidents which might be very common in BMTC buses, so if you notice –
 
  • Unnecessary scuffle in bus,
  • Guys standing at exit door, but not getting down,
  • Some one standing too close to you despite having sufficient space in bus,
  • Guys moving back and forth in bus
 
Then these are clear signs of you being next victim of mobile theft in BMTC bus.
 
Having realized that I had lost my mobile the very fist thing I did was to block the SIM as it was post paid connection.
Then I approached near by police station to lodge an FIR though was directed to go to another police station of. (Can’t there be coordination among police stations so we could lodge FIR any where)
When I approached another police station I was given all sorts of cogent comments to as to why FIR can not be launched in this case. (For some time I felt as if my mobile is not stolen at all!!!)
Finally they agreed to take complaint (though not FIR) and got me one acknowledgement.
Though I don’t have any hope of getting my mobile back, I wish that this post of mine would caution other about mobile theft in BMTC buses.
 
 
 
 
 
 

Tuesday, April 13, 2010

Working With FCK editors

I had troubles working with FCK editors using QTP.
As these editors are recorded as “WebElement” it is not possible to perform “Set” operation on them
I came across two posts which talk about dealing with this issue,
 
One is of Tarun’s where in talks about using “object” as well as “DeviceReplay” methods which could be used to simulate control on FCK editor
He suggests not using “object” for browsers other than IE as it is supported only in IE
 
 
Browser("testB").Page("testP").Frame("Frame").WebElement("WebElement").object.innerText = "Text
Browser("testB").Page("testP").Frame("Frame").WebElement("WebElement").object. innerHTML
= "<h1>Text</h1>
 
 
While other method uses object “DeviceReply” object to exercise object on which control is brought.
 
'Click on Application Object
Browser("testB").Page("testP").Frame("Frame").WebElement("WebElement").Click
 
'Create device replay object
Set oDR = CreateObject("Mercury.DeviceReplay")
 
'Send some text
oDR.SendString "Text Text"
 
'Deallocate Object
oDR = Nothing
 
There is one more portal which provides more detail information it – Advanced QTP, did not have time to go through it
 
THanks,
Tarun K
 
 

Thursday, April 8, 2010

Strange QTP Errors and Possible Solutions

Herein I have listed couple of error which I encountered while working with QTP. Some of these are very cryptic and you just can not guess about their Raison d'ĂȘtre.I have listed these errors
hoping it would help a new bird.









































Error while opening Test















On Debug











Error with Function

Error while using a function whose definition was not available in Action











Unable to work with IE

Unable to recognize IE window; had to restart the browser




















General Run Error

There have been multiple instances of General Run Error with QTP; they just don’t let u know as to what went wrong. On such instance is when I was mistakenly trying to check a check box which was disabled. Instead of General Run Error, there could have been a more comprehensible error like – “object is disabled…”


Monday, April 5, 2010

QTP AOM File

Here in I have got sample AOM file which invokes QTP test. This file also pushes test results to a designated folder. Herein there is no hard coding of path ant where in AOM file -

##################################################
Dim qtpApp 'As QuickTest qtpApplication
Set qtpApp = CreateObject("QuickTest.Application")
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

qtpApp.Launch
qtpApp.Visible = True

qtpApp.Test.Settings.Launchers("Web").Active = False
qtpApp.Test.Settings.Launchers("Web").CloseOnExit = True
qtpApp.Test.Settings.Run.ObjectSyncTimeOut = 240000
qtpApp.Test.Settings.Run.DisableSmartIdentification = True
qtpApp.Test.Settings.Run.OnError = "Dialog"
qtpApp.Test.Settings.Web.BrowserNavigationTimeout = 60000

qtpApp.Options.Run.RunMode = "Fast"
qtpApp.Options.Run.ViewResults = True
qtpApp.Options.Run.MovieCaptureForTestResults = "Never"
qtpApp.Options.Web.AddToPageLoadTime = 10
qtpApp.Options.Web.BrowserCleanup = True
qtpApp.Options.Run.ImageCaptureForTestResults = "OnError"

'Get path to trunk
sn = Wscript.ScriptName 'Script Name
fn = Wscript.ScriptFullName 'Fully Qualified Script Name
fp = Replace(fn, "\" & sn, "") ' Drive / Folder path

Set fso = CreateObject("Scripting.FileSystemObject")

'Open the test in read-only mode
qtpApp.Open fso.GetFolder(fp).ParentFolder& "\test_scripts\GSBRegMF1Event", True

'Create the Run Results Options object
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")

'Set the results location
timeStamp = FormatDateTime(Now, 1)&" "& Hour(Time) &"-"& Minute(Time) &"-"& Second(Time)
qtResultsOpt.ResultsLocation = fso.GetFolder(fp).ParentFolder& "\results\GSBRegMF1Event\" &timeStamp

qtpApp.Test.Run qtResultsOpt 'Run the test


Set qtpApp = Nothing
Set qtResultsOpt = Nothing
Set fso = Nothing
##################################################

Thursday, April 1, 2010

Reading Outlook Contents From VB Script

There are instances when an application involves mail delivery for certain app features. one way to automated this is to hook with Outlook and read content of mail (though I am not very comfortable with this approach anyways!)

####################################
'Get the Count of Items in Inbox
Set app = CreateObject("Outlook.Application")
Set nameSpace = app.GetNamespace("MAPI")
Set MyFolders = nameSpace.GetDefaultFolder(6)
MsgBox MyFolders.Items.Count


'Read unread items in Inbox
Set cols = MyFolders.Items

For each mail In cols
If mail.unread Then
MsgBox mail.subject
MsgBox mail.sendername
MsgBox mail.body
mail.unread=false
End If
Next
####################################

VB Script and ADO DB

VB Script can be used to establish db connection. This is very useful in QTP for writing db test cases. DB connection can be established for both SQL Server Authentication as well as Windows Authentication -

#########################################
Function Func_dbConnect

On Error Resume Next

'Creating the Connection Object
set cn = CreateObject("ADODB.Connection")

'Setting the Data Source
strCS = "Driver={SQL Server}; Server=1.1.1.1; Database=GSBREG_021010; UID=us; PWD=us;"

'Open Connection
cn.Open strCS

If (Err.Number<>0) Then
MsgBox("Login Failed")
End If

Set Func_dbConnect = cn

End Function


Sub ExecuteSQLQuery

Set cn = Func_dbConnect()

'Creating RecordSet Object
Set rs = CreateObject("ADODB.recordset")
rs.CursorType = 2

'SQL query
FetchAcademicLevels = "Select even_id from allocation_event"_
&" where allocation_name = 'myname'"

Set rs = cn.Execute(FetchAcademicLevels)

If(rs.EOF) Then
MsgBox "No Records"
Else

For Each x in rs.Fields
MsgBox x.name
MsgBox x.value
Next
rs.MoveNext

End If

rs.Close
cn.Close

End Sub


ExecuteSQLQuery()
#########################################

For Windows Authentication Connection String should be -

#########################################
strCS = "Driver={SQL Server}; Server=171.64.216.197; Database=copernicus_gsbreg_b2b_new; Trusted_Connection=Yes"
#########################################

Google Chrome Crashes

Got this error message once while working on Chrome. Only Google can have such uncanny knack for error message

Fork me on GitHub