Unlike Internet Explorer, the QTP in-built maximize function doesn't work for firefox. So, to achieve this goal I did following 1. I added the firefox browser object in the object repository with help of object spy, and renamed it FirefoxBrowser 2. Used this code:- hwnd=Browser("FirefoxBrowser").getROProperty("hwnd") Set FireFox = Description.Create() FireFox("hwnd").value = hwnd Window(FireFox).Maximize
Often, we come across some scenario where we have to search some specific “text” which is link in property, and wants to click it. So, here is the awesome vba function for you to solve the problem 1. Copy Paste this piece of code in your function library (For example Test.qfl) Function FindTextAndClickLinkInWebTable(ByVal TestObject, ByVal FindText, ByVal FindTextInColumn, ByVal LinkColumn) 'in case of any errors On Error Resume Next 'checking whether the object exist ObjectExist = TestObject.Exist(15) If ObjectExist Then 'setting MatchFound as false MatchFound = FALSE 'finding the total number of rows in the webtable TotalRows = TestObject.RowCount 'looping in the webtable until a match is found For CRow = 1 to TotalRows 'checking whether Searched Text is found searchEEtext = Trim(TestObject.GetCellData(CRow, FindTextInColumn)) ...
Guys, always take screenshot of the failed steps when creating a QTP test, it will saves your time in identifying the issue thru Result Viewer, and reduce the result analysis time. Below is the simple code to achieve that screenShot = “TestScreenShot”+ ".bmp" Browser("Test").CaptureBitmap screenShot Reporter.ReportEvent micFail, “Failed Reason”, “Failed Reason in Detail”, screenShot
Comments
Post a Comment