Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Webedit Issue
#1
Not Solved Exclamation 
Hi......!

In my application, I had an option to add customers. While clicking on Add it shows a popup with the web edit field and add button. The requirement is once the user adds already existing customer it displays an error message. So that user can try to add smother customers.
I got an error message if already existing customer exists. I need to set in the web-edit field with some other customer name which is used in Data table. How can i implement it - QTP descriptive programming?

Reply
#2
Not Solved
can u send the screen shot of the screen where u have to perform the task
Reply
#3
Not Solved
Hi Subha,
Please try the below solutions and see if it works for you..

Solution #1:
Change the Customer Name in the data table every time before executing the script. But it might be operationally tedious.

Solution #2:
Programmatically we can do this using the Solution #2.
Note: In this code, you will get a unique name every time you run the script. It will have 19 characters.

Let me know if any queries.

'Code Starts Here
Code:
Dim ReqMonth,ReqDay,ReqYear,ReqHour,ReqMin,ReqSec,CustomerName

ReqMonth = Right("0" & DatePart("m",Date()), 2)
ReqDay = Right("0" & DatePart("d",Date()), 2)
ReqYear = DatePart("yyyy",Date())
ReqHour = Right("0" & DatePart("h",Time()), 2)
ReqMin = Right("0" & DatePart("n",Time()), 2)
ReqSec =Right("0" & DatePart("s",Time()), 2)
CustomerName =  "Subha" & ReqYear & ReqMonth & ReqDay & ReqHour & ReqMin & ReqSec
'Code Ends Here

Thanks and Regards,
Swami
Reply
#4
Not Solved
Swami,

Thanks for your help. But the thing is i dont have any field stating month,year. The pop up only contains "Add Customer Name" and Add button.And am feeding the data through data-table with global action.Once i got the error message, i need to select the next row information from the data-table and have to set in it the edit box.Try to sort out this.
Reply
#5
Not Solved
Hi Subha,

In the above code u need not to have the month and year field. The script is fetching the system month,day,year in order to create a unique customer number.

However, as u said u have set of customers in the datatable, u can use the below code in case of error

'Your code goes here

Code:
intCurrentRow= Datatable.GetSheet(<SheetName>).GetCurrentRow

Do
Datatable.GetSheet(<SheetName>).SetCurrentRow intCurrentRow
strCustomer=Datatable(“<ColumnName>”,<SheetName>)
Browser("<BrowserName>").Page("<PageName>").WebEdit("<EditBoxName>").Set strCustomer
Browser("<BrowserName>").Page("<PageName>").WebButton("<Add Customer Button Name>").click
'chk if error exist
if <Error Window>.Exist Then
    <Error Window>.close
    intCurrentRow= Datatable.GetSheet(<SheetName>).GetCurrentRow
    intCurrentRow= intCurrentRow+1    
End IF

Loop While <Error Window>.Exist


Regards,
Ankesh
Reply
#6
Not Solved
Hi Subha,

Good Morning!

Below are the steps that you have to perform inorder to achieve your goa.

Code:
'Get the number of active rows from QTP Global sheet
Dim intRowCount : intRowCount = DataTable.GetRowCount

'Now you have to loop through all the rows in the Global Sheet
Dim intRowNum,strCustomerName
For intRowNum = 1 to intRowCount
  'Set the current row in the global sheet
   DataTable.SetCurrentRow intRowNum
  'get the current row value
   strCustomerName = DataTable("CustomerName",dtGlobalSheet)
  'Now set the customer name
  Browser("BR").Page("PG").WebEdit("CustomerName").Set strCustomerName
  'Click on Add Customer Button
  Browser("BR").Page("PG").WebButton("AddCustomer").Click
  'Check for the error message
   If Window("ErrMsgBox").Exist Then
       'Close the Error message box.
        Window("ErrMsgBox").WinButton("OK").Click
        'write the infomation that the customer already exist.
    Else
       'write the infomation that the customer added successfully.
        Exit For
   End If
Next
Please let me know if you need any further info.

@Ankesh : The only thing that I want to bring to your notice is as we are closing the error message window, I don't understand how the Do loop will works here and more over we have to loop till we are able to enter the info successfully with the number of rows available.
Thanks,
SUpputuri
Reply
#7
Not Solved
Hi.....

Thanks....I got some idea through your snippets.. And have a doubt.. I wont get the error message in a separate window. It get displayed in web page screen..So how can i make it possible..?
Reply
#8
Not Solved
If possible, It would be better if you can share/attach the screenshot of the screen, so that people can suggest you appropriately.
Reply
#9
Not Solved Shy 
Hi All.
I have a weblist designed using google web toolkit (GWT), of which it is detected as a webedit, instead of a weblist. Also it is not completely displaying all the items of the weblist.It is retrieving the data while scrolling.
Provide me a solution to detect this and select the appropriate value in the weblist. Also tell me if there are any plug in for qtp to detect this

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)