You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.
I am trying to use the browser.attach function to test a bit of AJAX on a web page. Here's the input field in the form:
The upload function contains this:
document.upload = function() {
...
var theFile = document.getElementById('uploadfile').files[0];
//upload theFile
var formData = new FormData();
formData.append(theFile.name, theFile);
var xhr = new XMLHttpRequest();
...
xhr.open("POST", '/upload', true);
xhr.send(formData);
...
}
In the zombie test I have:
browser.visit("http://localhost:8080", function(err, browser, status) {
...
browser.attach("input#uploadfile", "/Users/florin/detail.html");
...
}
Now I have 2 issues:
the onchange event is not fired. I am now calling upload() explicitly with: browser.document.upload()
The 'uploadFile' element doesn't contain the files array (it's a FileList that contains FileUpload objects, see http://www.w3schools.com/jsref/dom_obj_fileupload.asp). The error I get running this zombie test is:
TypeError: Cannot read property '0' of undefined
On a regular browser the code works fine.
What am I doing wrong?
florin
The text was updated successfully, but these errors were encountered:
For me onchange event is fired twice instead of once, see minkphp/MinkZombieDriver#90. Probably onchange triggering code was changed in 2.x versions of Zombie, that is caused that bug.
Hi,
I am trying to use the browser.attach function to test a bit of AJAX on a web page. Here's the input field in the form:
The upload function contains this:
document.upload = function() {
...
var theFile = document.getElementById('uploadfile').files[0];
//upload theFile
var formData = new FormData();
formData.append(theFile.name, theFile);
var xhr = new XMLHttpRequest();
...
xhr.open("POST", '/upload', true);
xhr.send(formData);
...
}
In the zombie test I have:
browser.visit("http://localhost:8080", function(err, browser, status) {
...
browser.attach("input#uploadfile", "/Users/florin/detail.html");
...
}
Now I have 2 issues:
TypeError: Cannot read property '0' of undefined
On a regular browser the code works fine.
What am I doing wrong?
florin
The text was updated successfully, but these errors were encountered: