can u write one user defined function for webedit class.
Answers were Sorted based on User's Feedback
Public function edit(name)
Browser("yahoo").Page("yahoo").Webedit("User Id").set name
End function
Call edit("Murali Raju")
Is This Answer Correct ? | 12 Yes | 6 No |
Answer / adlajaipal
'@generic function for Webedit
'@ arguments to pass values
Function WebEdit(sValue,sItem)
set Edit=description.create()
Edit("micclass").value="webedit"
set
basepage=Browser("micclass:=Browser").page("micclass:=Page").childobjects(Edit)
sCount=basepage.count
for i=1 to sCount
Edit=basepage(i).getroproperty("name")
if sValue=Edit then
basepage(i).set sItem
exit for
end if
next
end function
'@ call
WebEdit "Editbox name", "value of edit box"
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / sunitha
Gneric Function for WebEdit
Values strBrow,strPAge come from object repository
Value strEditboxName is the one which we get on spying the
object and getting its property name.
Value strVal is the one which we want to set in Edit box
function fg_SetValueinEditbox
(strBrow,strPage,strEditboxName,strVal)
set oD = Description.create
oD("micclass").value = "WebEdit"
set strEbox = Browser(strBrow).Page(strPage).Chilobjects(oD)
For iCnt=0 to strEbox.count-1
strName = strEbox(iCnt).GetROProperty("name")
If strcomp(strName,strEditboxName,1) = 0 Then
strEbox(iCnt).set strVal
Exit for
End if
Next
End Function
Is This Answer Correct ? | 3 Yes | 4 No |
Answer / zakir qureshi
DataTable.AddSheet("FrameWork")
DataTable.ImportSheet "D:\Excel Automation -
Imp\Frame.xls","FrameWork","FrameWork"
varRowCnt=DataTable.GetSheet("FrameWork").GetRowCount
For i=1 to varRowCnt
DataTable.GetSheet("FrameWork").SetCurrentRow(i)
Set
varBrowser=Browser(datatable.Value("BrowserPropName","FrameWork")&":="&datatable.Value("BrowserValue","FrameWork"))
Set
varPage=varBrowser.Page(datatable.Value("PagePropName","FrameWork")&":="&datatable.Value("PageValue","FrameWork"))
Set
varObject=varPage.WebEdit(datatable.Value("ObjPropName","FrameWork")&":="&datatable.Value("ObjValue","FrameWork"))
varObjValue=DataTable.Value("Expected","FrameWork")
varCnt=Set_EditBoxValue(varBrowser,varPage,varObject,varObjValue)
Next
Public Function
Set_EditBoxValue(varBrowser,varPage,varObject,varObjValue)
'Set
varBrowser=Browser(datatable.Value("BrowserPropName",dtglobalsheet)&":="&datatable.Value("BrowserValue",dtglobalsheet))
varBrowserExist=""
varBrowserExist=varBrowser.Exist(2)
If varBrowserExist="True" Then
Set_LoginDetails=varBrowserExist
'Set
varPage=varBrowser.Page(datatable.Value("PagePropName",dtglobalsheet)&":="&datatable.Value("PageValue",dtglobalsheet))
varPageExist=""
varPageExist=varPage.Exist(2)
If varPageExist="True" Then
Set_LoginDetails=varPageExist
'Set
varObject=varPage.WebEdit(datatable.Value("ObjPropName",dtglobalsheet)&":="&datatable.Value("ObjValue",dtglobalsheet))
varObjectExist=""
varObjectExist=varObject.Exist(2)
If varObjectExist="True" Then
Set_LoginDetails=varObjectExist
varObject.Set varObjValue
varActualValue=varObject.GetROProperty("value")
DataTable.Value("Actual","FrameWork")=varActualValue
If trim(varActualValue)=trim(varObjValue)Then
DataTable.Value("Result","FrameWork")="Pass"
Else
DataTable.Value("Result","FrameWork")="Fail"
End If
Else
Reporter.ReportEvent 1,"Object does not exist","Object
does not exist"
DataTable.Value("Result","FrameWork")="Object does not
exist"
Set_LoginDetails=varObjectExist
End If
Else
Reporter.ReportEvent 1,"Page does not exist","Page does
not exist"
DataTable.Value("Result","FrameWork")="Page does not exist"
Set_LoginDetails=varPageExist
End If
Else
Reporter.ReportEvent 1,"Browser does not exist","Browser
does not exist"
DataTable.Value("Result","FrameWork")="Browser does not exist"
Set_LoginDetails=varBrowserExist
End If
DataTable.ExportSheet "D:\Excel Automation -
Imp\Frame.xls","FrameWork"
End Function
Is This Answer Correct ? | 2 Yes | 5 No |
Answer / kiran
'Bname -- Browser name
' Pname- Pagename
' EditName---Editboc name
'Edittag--html tag name
'indx-Index of object
'InputVal---inputvalue
Public Sub SetWebEdit
(Bname,Pname,EditName,Edittag,index,InputVal)
If Browser("name:="&Bname).Page("title:="&Pname").WebEdit
("name:="&EditName,"html
tag:="&Edittag,"index:="&indx).exist
Browser("name:="&Bname).Page("title:="&Pname").WebEdit
("name:="&EditName,"html tag:="&Edittag,"index:="&indx).set
InputVal
Reporter.ReportEvent micpass,"The Object is exist and set
value suuccesfully","Pass"
Esle
Reporter.ReportEvent micFail,:the object is not existing
and filled","Fail"
End If
End Sub
Is This Answer Correct ? | 0 Yes | 3 No |
Answer / krishna madiga
i think a lot of time about this question .but i did 'nt
get sorry....
Is This Answer Correct ? | 1 Yes | 7 No |
how to merge object repositories?
Define QTP ?
How to run a test using quicktest professional (qtp)?
we have 5 default properties we want add more Default property in Object Repository how to add the property
How we can add objects to the object repository during the running?is it possible or not?explain
How to read a text file from QC using QTP. I would like to do something like this. But instead read a file from QC and NOT from my local drive. Set fso = CreateObject("Scripting.FileSystemObject") Set InputFile = fso.OpenTextFile("C:\test.txt", ForReading) Thanks
Can you write a script to check if the folder exists or not?
Hi frnds, does anybody know if there is anything called "thin point" or something in qtp? thanks in advance.
What are Test case selection criteria for Automation?
Hi Friends, I'm new to QTP. I want to write a function in QTP for below senario. In an Excel sheet column B, I Have 10 Url/Links, and in Colum A there is a Flag as Y and N. My test should run only on those iterations which are flagged as Y. Please help, Thanks
How good are you in writing VBscript code for your application? Can you completely write VBscrit for your project with out using recording mode in QTP?
example-date format is 01-jan-09 in QTP.How to convert this format to 01-01-09?