Micro Focus QTP (UFT) Forums

Full Version: Not able to set value in WebFile when Windows is locked
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Guys,

I was running a script on a website and in a particular action I faced a problem where the scenario was to upload a document to the site. Following is the process:

1. When I click on a WebButton, a small fixed size browser pops up with a WebFile named "documentfile" and a WebButton named "Upload" inside it.

2. I have to provide the path of the document on the WebFile and click on the "Upload" button.

3. If I leave the WebFile blank and click on the "Upload" button, it shows a warning saying "Provide correct document path"

Now when I am running the script in an opened Windows,it is working fine i.e Document is getting uploaded. But when I am running the script and locking the Windows ( By pressing "Windows + L " keys), the warning message "Provide correct document path" is shown, that means the path is not being set on the webfile when Windows is locked.

I am providing the document path from Data Table

Can anybody come out with a solution to this so that I can run this script in an Locked Windows environment.
Hi Prabhat,

It is recommended, not to run the scripts in an Locked Windows environment and if you run you will encounter this kind of problem basically for click event.
But Anirban, You said that basically for "Click" event I'll encounter problem when Script is running in a Locked Windows environment. But in my case, the WebButon is getting clicked, the Browser is popping up, the Upload button is getting clicked. Only thing that is not happening is Setting the document path in the WebFile.

I would like to know your opinoin.

And why it is recommended that we should not run a script in a Locked Windows environment ? And if we encounter any/many problem(s),then why so ?
Hi Prabhat,

Try in the below ways & check.

Way1:
Code:
Browser("B").Page("P").WebFile("F").Highlight
Browser("B").Page("P").WebFile("F").Set "Document Path"

Way2:
Code:
Setting.WebPackage("ReplayType") = 2
Browser("B").Page("P").WebFile("F").Set "Document Path"
Setting.WebPackage("ReplayType") = 1
Hi Sreekanth,

I tried both the ways suggested by you but not able to resolve the issue.

I even tried with Setting.Packages.WebPackage.Settings("ReplayUsingSourceIndex") = 0/1, but this also didn't help.

Actually my piece of code is as follows:

Code:
With Browser("Document Upload")
        .WaitProperty "name", "Document Upload", 20000
        [color=#0000CD].Page("Document Upload").WebFile("documentfile").Check CheckPoint("documentfile")
        .Page("Document Upload").WebFile("webdocumentfile").Check CheckPoint("webdocumentfile")[/color]
        [color=#FF0000].Page("Document Upload").WebFile("documentfile").Set DataTable("DocumentFilePath_In",dtLocalSheet)[/color]        
.Page("Document Upload").WebButton("Upload...").Click
End With

The 2 lines colored as blue are two checkpoints on the two webfiles which pass even if Windows is locked.

The line colored in red is to set the document path on the webfile which is not setting any value in the webfile

The "Upload... " button is getting clicked.

So here the only problem is Setting value in the WebFile

Please suggest
Hi,

Refer the below example & try it out and see.

Code:
x = Browser("B").Page("P").WebFile("F").Object.clientHeight \ 2
y = Browser("B").Page("P").WebFile("F").Object.clientWidth - 5
Browser("B").Page("P").WebFile("F").Click x,y
Browser("B").Dialog("text:=Choose file").WinEdit("attachedtext:=Filename","nativeclass:=Edit").Set DataTable("DocumentFilePath_In",dtLocalSheet)
Hi,

As srikanth already gave the all solutions for that if still not working with that then you could use the "Send Keys" as the final option.
"
My Assumption: After opening the "Dialog Window" if the cursor is focused in "Choose File" edit box then pass the entore path using "Send Keys"

Hopefully it will solve this issue.

Please let me know for further clarification.

Thanks and Regards,
Venkat.Batchu