Highlighted
Absent Member.
Absent Member.
398 views

Not able to clear the text in a search text box.

Hi All,

This is Maruthi and I am a new learner to UFT Automation tool. I have few questions in the below mentioned scenario. please help 🙂

Scenario:
"Click on Start button - Click on Outlook 2013 - Click on New Email - Clcik on To button - Enter some text and click on Go button to search for the user email id - (here i want to clear the text in the search text box shown in the pop-up and re-type some new text to search again)"

Below is the code that I am using in my script to run the above scenario:

Window("nativeclass:=Shell_TrayWnd").window("nativeclass:=Button","regexpwndtitle:=Start").Click
Window("regexpwndtitle:=Start menu").WinListView("nativeclass:=SysListView32","regexpwndclass:=SysListView32","all items:=Outlook 2013\nPicPick Portable \(PortableApps\.com Launcher\)\nGoogle Chrome\nSkype for Business 2015\nExcel 2013\nWord 2013\nNotepad\nMobilePASS\nSticky Notes\nCalculator\nPaint\nOneNote 2013").Select("Outlook 2013") 
Window("nativeclass:=rctrl_renwnd32").WinObject("nativeclass:=window","acc_name:=Ribbon").WinButton("nativeclass:=push button","acc_name:=New Email").click
Window("regexpwndtitle:= Message \(HTML\)").WinButton("nativeclass:=Button","regexpwndclass:=Button","text:=To&...").click
Window("regexpwndtitle:= Message \(HTML\)").Dialog("regexpwndtitle:=Select Names: Global Address List","text:=Select Names: Global Address List").WinRadioButton("regexpwndtitle:=Mo&re columns").Click
Window("regexpwndtitle:= Message \(HTML\)").Dialog("regexpwndtitle:=Select Names: Global Address List","text:=Select Names: Global Address List").WinObject("attached text:=&Search:","regexpwndclass:=RichEdit20W").Type"Maruthi-kumar.n-r@hpe.com"
Window("regexpwndtitle:= Message \(HTML\)").Dialog("regexpwndtitle:=Select Names: Global Address List","text:=Select Names: Global Address List").WinButton("regexpwndtitle:=&Go").Click
Window("regexpwndtitle:= Message \(HTML\)").Dialog("regexpwndtitle:=Select Names: Global Address List","text:=Select Names: Global Address List").WinObject("attached text:=&Search:","regexpwndclass:=RichEdit20W").Click

Questions:

1) In the 2nd line of code - I have used "all items:=...." to identify the list items in start menu and then used Select command to click on Outlook 2013 list item - Q) here if the sequence changes, then the object will not be identified and test case will fail for sure. Can any one please help how to overcome this issue?

2)After clicking on the To button in the new email - I am typing "Maruthi-kumar.n-r@hpe.com" to search - and then click on Go button to search - there are no results found and now i want to clear the text to re-type some new text and again perform the same action. Can anyone help on this as well???

Attached herewith the screenshot for your reference.

0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

Re: Not able to clear the text in a search text box.

Outlook automation can be achieved in another way. I am giving sample here. You can investigate further to suit your requirements.

 

path = "C:\Untitled.png"

Set Outlookapp = CreateObject("Outlook.Application")
Set myMail = Outlookapp.CreateItem(olMailItem)

If Outlookapp.ActiveInspector.IsWordMail = True Then
    With myMail
        .Display
        .To = "sssbbb@hp.com"
        'myMail.CC = "abc@hp.com; xyz@hp.com" 'Sending mails to multiple ids
        .Subject = "subject of the email"
        .Body= "Body of the email "
        .Attachments.Add(path)   
    End With
End If

myMail.Send

Set myMail = Nothing
Set Outlookapp = Nothing


Accept as solution/Give Kudos to the author if the piece of information answered/helped you to solve your problem.
All the thoughts here are mine not related to my employer nor anyone.
Tags (1)
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Not able to clear the text in a search text box.

Hi Swaroopjoshi,

Thanks for the quick reply and helping note. It looks really great and simple but would you mind to please explain me more in detail how the script acutally runs.

Regards,

Maruthi

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.