I have an application where it accepts jpeg, png but not html files.
Using await t.setFilesToUpload(); but it's passing for html files aswell!!!
Is there a way to test the invalid file formats?
Related
I have successfully been able to upload file when the filename is just one word, When there are spaces in the name, the file, I get error from server.
Example: 1.] '.../musics/Love.m4a' -> upload successfully
2] '.../musics/Love Thy Neighbor.m4a' -> upload failed
Any idea on how to handle this issue in React native will be highly appreciated.
I have been trying to upload an audio file in react-native but because of space in file name not being able to upload to server, I get below error from a server;
**file:** {uri: 'file:///Users/fathom-d004/Library/Developer/CoreSi…m.brandarmy.user1-Inbox/Love%20Thy%20Neighbor.m4a',
name: 'Love Thy Neighbor.m4a', type: 'audio/x-m4a'}
error: Error: ENOENT: no such file or directory, open '/Users/fathom-d004/Library/Developer/CoreSimulator/Devices/83619055-D45F-4FA9-85CC-A2009A599EA7/data/Containers/Data/Application/FE596B31-0385-4F77-B342-EF354F86FF1B/tmp/com.brandarmy.user1-Inbox/Love%2520Thy%2520Neighbor.m4a'
Used below simple solution;
I believe I've found the error. The issue was that the file I was uploading had a space in it, so we need to decode the URL first before uploading file to server, like:
var decodedURL = decodeURIComponent(file.uri);
const base64 = await fs.readFile(decodedURL, "base64");
Thanks...!
Hi I am Trying Achieve File upload Scenario My Test cases using selenium
Element I am Doing Actions On:-
<input _ngcontent-swn-c63="" type="file" id="undefined" multiple="" accept=".gif, .xlsm, .zip, .xls,.xlsx, .pdf, .ppt, .pptx, .doc, .docx, .jpeg, .jpg, .png, .csv, .txt">
Selenium Script I am Using :-
WebElement UploadElement=(new WebDriverWait(driver, BaseInitializer.defaultwaitTime)).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[#type='file' and #id='undefined']")));
((JavascriptExecutor)driver).executeScript("arguments[0].style.display = 'block';", UploadElement);
UploadElement.sendKeys(newname.getAbsolutePath());
While the above piece of code is working in My Local Machine(Chrome browser). Same script is not working while running the code in Azures Pipeline. The File is not getting reflected in Upload Element. What may be the issue? Or I am missing something?
Enabled video in the selenium grid extras config json file and able to see mp4 videos saved under video output folder.
How do I get the saved mp4 file name of a test programatically ?
Also, is it possible customize the file name to give it a meaningful name like testname_dateofexecution ?
RemoteWebdriver has a method GetCapabilities. Capability 'webdriver.remote.sessionId' returns the session id which is the file name of the mp4 file created in video output folder
I am using Yii EAjaxUpload extension to upload files. I am facing a problem during uploading image. 'Getting content length is not supported'. In console It is showing the error "http://46.101.98.121/MyApp/index.php?r=controller/upload&PHPSESSID=j7…KEN=077cb06478a3c70e40a2a01dc4cb1a94a6ff96ec&qqfile=518164-backgrounds.jpg". In php.ini 'upload_max_filesize' and 'post_max_size' both are 100MB. File is already uploaded to the destination folder but the uploading procedure fails each time. Please help.
Upon invsetigating 'mu is too short's answer to this question, I noticed that I get different behaviour in jsFiddle than in my local context for the exact same script. Any clues as to why that is?
Note:
I am not getting any javascript errors in Firefox's error console in the local context.
UPDATE:
I tried grabbing the HTML from fiddle.jshell.net/ambiguous/ZEx6M/1/show/light to a local file and loading that local file in Chromium browser and I got the following errors in the javascript console:
GET file:///css/normalize.css undefined (undefined) /css/normalize.css
GET file:///css/result-light.css undefined (undefined) /css/result-light.css
Resource interpreted as Script but transferred with MIME type application/empty jquery.scrollTo-1.4.2.js:-1
Resource interpreted as Script but transferred with MIME type text/plain jquery.viewport.js:-1
I can get rid of these javascript errors by downloading the files and modifying the <script> tags, but it doesn't solve the problem. The page still scrolls down to the very bottom. Also these errors appear even in the working (jsFiddle) version.
I also tried the same process in Konqueror. Result: the script does absolutely nothing.
Don't use separate files for CSS and javascript. Just bring everything into HTML file (using inline javascript and inline CSS) and you should be OK.
Or, run a web server locally to serve the javascript file (with the correct MIME type) and use relative paths to CSS.