Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unable to control browser pop-up file selection form
#1
I'm having trouble using QM with the HTML provided below (which I have heavily edited to try to leave just the important stuff). The HTML displays an edit box, into which a file name can be typed. Or a Browse button can be clicked, at which point a form pops up to allow the user to select the file to be downloaded. Note the Validator at the end of the HTML.

Note that any attempt to access the popup form when run under Firefox fails completely: QM is unable to "see" the popped up form at all. Thus, I am forced to run under IE.

I can get QM to tell me the information about the IE popup form, and even about the file name edit field, but all attempts to manipulate the field have failed. When I do a Click on the field, the file form does pop up, but QM pauses until that form closes before QM continues. This, of course, makes it impossible for me to control that form from QM, which was the whole point of the exercise.

If I replace the Click with a Key, all I hear are beeps: the key strokes never make it successfully to the edit box which is waiting for the file name

Here's the failing QM code:

===

str fName.from("C:\fred.csv");

out "Processing: %s" fName

web "http://localhost/submit/"

Htm el=htm("INPUT" "uploadedfile" "" win("Windows Internet Explorer" "IEFrame") 0 0 0x221)
out "after EL defined"

el.SetFocus
out "after SetFocus"

el.Click
out "after click"

int hwnd=child("" "Edit" win("Choose file" "#32770") 0x5)

===

and here is the minimized HTML:

===


<!--FORM_WIZ{-->
<SCRIPT src="validatorv3.js" type="text/javascript"></SCRIPT>
<!--}FORM_WIZ-->

</head>

<body>

<form name="MAINFORM" enctype="multipart/form-data" method="post" action="takexls2.php">
<input name="uploadedfile" type="file" size="60" style="font-size: 10pt; font-family: Trebuchet MS"

/>
</form>

<SCRIPT type="text/javascript">
var MAINFORMValidator = new Validator("MAINFORM");
MAINFORMValidator.addValidation("uploadedfile","req","Please select the file to upload.");
</script>

</body>

</html>
#2
If I try this:

===

Htm el=htm("INPUT" "uploadedfile" "" win("Windows Internet Explorer" "IEFrame") 0 0 0x221)
out "after EL defined"
el.SetFocus
out "after SetFocus"
el.SetText("fred")

===

I get this:

===

Error (RT) in VC Test: 0x800A0258,
#3
el.SetText and el.el.setAttribute("value"...) don't work with file fields. Accessible object's a.SetValue too.

key should work.

Code:
Copy      Help
act win(" Internet Explorer" "IEFrame")
Htm el=htm("INPUT" "file" "" win(" Internet Explorer" "IEFrame") 0 0 0x221)
el.SetFocus
key "file.zip"

Code:
Copy      Help
act win("Mozilla Firefox" "MozillaUIWindowClass")
Acc a=acc("Browse..." "PUSHBUTTON" win("Mozilla Firefox" "MozillaUIWindowClass") "MozillaContentWindowClass" "" 0x1001 0 0 "previous")
a.Select(1)
key "file.zip"

----

To click and don't wait, use el.ClickAsync. It is new in QM 2.2.1.
#4
Thanks. The second set of code, for Firefox, works, although I NEVER would EVER have figured this out from the available documentation.

Thanks for the help: I wish the documentation were better (like a Search for "settext" says there are no topics present).

Smile

Jon
#5
Try this alternative help search:

Quickly find help and tools (for QM < 2.3.0)


Forum Jump:


Users browsing this thread: 1 Guest(s)