Hi All,
Now I am going to describle the undocumented feature of QTP that is ClickONText method . Some time we require the object text location ( x ,y position ) in window so that we can click that object by use Get text location method. like this
rem Open the “C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe” application.
SystemUtil.Run “C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe”,”C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe”,”"
rem Make the “Login” dialog box active.
Dialog(“Login”).Activate
TESTEVERYTHING
Thursday, 4 August 2011
Wednesday, 27 July 2011
VB Get All Web page text ( Including All Webelement )
Hi All,
Some Time we have to check that particular text is present on page or not during automation. If we get the page outer HTML in QTP we can not get the whole text of all element like frame , webtable . div.etc…
So i created a function which will check that the given text is present on page or not If Text present on page it will return True else False
msgbox VerifyTextPresentOnPage(objpage ,”rajiv” )
Some Time we have to check that particular text is present on page or not during automation. If we get the page outer HTML in QTP we can not get the whole text of all element like frame , webtable . div.etc…
So i created a function which will check that the given text is present on page or not If Text present on page it will return True else False
REM ——- Set page object ———-
set objpage = Browser(“BrowserName”).Page(“Pagename”)msgbox VerifyTextPresentOnPage(objpage ,”rajiv” )
Function VerifyTextPresentOnPage(byval objpage , byval Textvalue )
On error resume next
Saturday, 23 July 2011
Get Column Names of WebTable using QTP
REM Get Column names from webtable
Here first row of table is considered as column so using getcelldata method for first row of web table
For clmNo =1 to mGetColumnCount
msgbox Browser("XYZ").Page("OBC").WebTable("Request Summary").GetCellData(1,clmNo)
Next
| Select | Date | ConfirmationNumber | User Name | Organization Name |
|---|---|---|---|---|
17-SEP-2008
|
13761
|
SMITH'S LP SUPPLY CO.
|
Here first row of table is considered as column so using getcelldata method for first row of web table
For clmNo =1 to mGetColumnCount
msgbox Browser("XYZ").Page("OBC").WebTable("Request Summary").GetCellData(1,clmNo)
Next
Select the row in WEBTABLE/WEBGRID using QTP/DOM
Hi All,
I found that most of time while working with WEBTABLE we need to the select the row based on some criteria by clicking checkbox or radiobutton.For that first we have to find the row which we have to select based on value of that row like text/link inside the row.
Here I am giving an example how to select a row in Webtable by finding the text. Logic I am using here is first i will find the row number from webtable where my searching text is present using GetRowWithCellText method then I will provide the column name/index of webtable where checkbox is present.
In below mentioned example I will select the row where Confirmation Number is "15204"
Let's see
REM find the row number where "15204" text is present using GetRowWithCellText method
GtRowN = Browser("XYZ").Page("OBC").WebTable("Request Summary").GetRowWithCellText("15204")
REM check text find in webtable or not
If GtRowN >0 Then
REM coulmn index where checkbox is present
Rem here select coulmn name index value is 1
CoulmnIndex = 1
REM create the checkbox object after getting the rownumber and select the row by clicking the checkbox
set objCheckbox = Browser("XYZ").Page("OBC").WebTable("Request Summary").ChildItem(GtRowN,CoulmnIndex,"WebCheckBox",0)
objCheckbox.set "ON"
else
msgbox "Did not find the value test fail"
End If
I found that most of time while working with WEBTABLE we need to the select the row based on some criteria by clicking checkbox or radiobutton.For that first we have to find the row which we have to select based on value of that row like text/link inside the row.
Here I am giving an example how to select a row in Webtable by finding the text. Logic I am using here is first i will find the row number from webtable where my searching text is present using GetRowWithCellText method then I will provide the column name/index of webtable where checkbox is present.
In below mentioned example I will select the row where Confirmation Number is "15204"
Let's see
| Select | Date | ConfirmationNumber | User Name | Organization Name |
|---|---|---|---|---|
17-SEP-2008 | 13761 | SMITH'S LP SUPPLY CO. | ||
24-OCT-2008 | 13808 | Micro Motion test1 | ||
30-OCT-2008 | 13874 | EMERSON PROCESS MANAGEMENT ASIA PACIFIC PTE LTD | ||
13-JUN-2009 | 15058 | Spartan Controls Ltd. | ||
08-AUG-2009 | 15204 | Emerson Process Management |
REM find the row number where "15204" text is present using GetRowWithCellText method
GtRowN = Browser("XYZ").Page("OBC").WebTable("Request Summary").GetRowWithCellText("15204")
REM check text find in webtable or not
If GtRowN >0 Then
REM coulmn index where checkbox is present
Rem here select coulmn name index value is 1
CoulmnIndex = 1
REM create the checkbox object after getting the rownumber and select the row by clicking the checkbox
set objCheckbox = Browser("XYZ").Page("OBC").WebTable("Request Summary").ChildItem(GtRowN,CoulmnIndex,"WebCheckBox",0)
objCheckbox.set "ON"
else
msgbox "Did not find the value test fail"
End If
Tuesday, 28 June 2011
Query from text file and retrieve records using ADODB
Query from text file and retrieve records
For example we have the following text file “Employees.txt”
LastName,FirstName,Department,Role
Nandvani,Rajiv,IT,Manager
Kumar,PP,Finance,Analyst
Shukla,Nikhil,R&D,Programmer
Singh,ANIL,QA,Tester
ARORA,ANUJ,QA,Team Leader
Kumar,Neeraj,IS,Manager
Is it important that your text files be formatted like this? It’s not just important,
it’s crucial. We’re going to use database techniques to retrieve information from
the file, and to do that the file needs to be delimited in some way (in this case,
using the comma as the delimiter).
For example we have the following text file “Employees.txt”
LastName,FirstName,Department,Role
Nandvani,Rajiv,IT,Manager
Kumar,PP,Finance,Analyst
Shukla,Nikhil,R&D,Programmer
Singh,ANIL,QA,Tester
ARORA,ANUJ,QA,Team Leader
Kumar,Neeraj,IS,Manager
Is it important that your text files be formatted like this? It’s not just important,
it’s crucial. We’re going to use database techniques to retrieve information from
the file, and to do that the file needs to be delimited in some way (in this case,
using the comma as the delimiter).
Monday, 27 June 2011
QTP Mercury DeviceReplay vs SendKeys/ Right click mouse
The Device Replay feature is used to perform mouse and keyboard actions against screen coordinates that are provided. The Device Replay functions are not automatically recorded, but must be programmed manually in the Expert View.
1. Create the Device Replay Object.
Example:Set DeviceReplay = CreateObject(“Mercury.DeviceReplay”)
2. Call the desired Device Replay function.
Example:DeviceReplay.SendString(“Hello, World”)
3. When done with the Device Replay object, release it.
Example:Set DeviceReplay = Nothing
The functions that can be used with the Device Replay object are (all coodinates are relative to the top left corner of the screen):
Sunday, 26 June 2011
JMETER run in GUI mode from putty on remote Linux machine.
Jmeter run in GUI mode from putty on remote Linux machine.
Please do the following steps to see the Jmeter window.
1. Install Xming ( http://www.straightrunning.com/XmingNotes/ ) on windows.
Download Source (install with portable putty enabled option.)
http://sourceforge.net/projects/xming/
2. Enable the X11 forwarding in putty.
3. Xming installation directory there is a host file C:\Program Files\Xming\X0.hosts
Edit: X0.hosts (lay in the installation directory)
add the ip you want to allow. my X0.hosts
“localhost
10.6.9.21″
Here 10.6.9.21 is the ip address of Linux machine.
4. Start your SSH session
5. On your ssh remote session, put this :
DISPLAY=YOUR_IP_WINDOWS:0.0
export DISPLAY
(Replace YOUR_IP by the IP of your windows)
Verify display is set or not
Type echo $DISPLAY
Still if you are not able to set Display variable value
Then update in profile file
Note: Here 10.193.68.125 is the ip address of windows machine
6. set up to permit X forwarding on Linux machine
Configure the /etc/ssh/sshd_config file
Your sshd_config file should have something like:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
7. Start the Xming server on Windows machine.
8. Run the putty
9. Now navigate to jmeter bin folder and run jmeter.sh file
Reference links
http://jmeter.512774.n5.nabble.com/Jmeter-run-on-Linux-using-putty-tp4364104p4364687.html
http://en.gentoo-wiki.com/wiki/X-Forwarding
Please do the following steps to see the Jmeter window.
1. Install Xming ( http://www.straightrunning.com/XmingNotes/ ) on windows.
Download Source (install with portable putty enabled option.)
http://sourceforge.net/projects/xming/
2. Enable the X11 forwarding in putty.
3. Xming installation directory there is a host file C:\Program Files\Xming\X0.hosts
Edit: X0.hosts (lay in the installation directory)
add the ip you want to allow. my X0.hosts
“localhost
10.6.9.21″
Here 10.6.9.21 is the ip address of Linux machine.
4. Start your SSH session
5. On your ssh remote session, put this :
DISPLAY=YOUR_IP_WINDOWS:0.0
export DISPLAY
(Replace YOUR_IP by the IP of your windows)
Verify display is set or not
Type echo $DISPLAY
Still if you are not able to set Display variable value
Then update in profile file
Note: Here 10.193.68.125 is the ip address of windows machine
6. set up to permit X forwarding on Linux machine
Configure the /etc/ssh/sshd_config file
Your sshd_config file should have something like:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
7. Start the Xming server on Windows machine.
8. Run the putty
9. Now navigate to jmeter bin folder and run jmeter.sh file
Reference links
http://jmeter.512774.n5.nabble.com/Jmeter-run-on-Linux-using-putty-tp4364104p4364687.html
http://en.gentoo-wiki.com/wiki/X-Forwarding
Subscribe to:
Posts (Atom)