jquery - Selenium error with javascript file upload validation -
i trying create functional tests using selenium (on django / python), javascript file validation brings error. site takes csv file input , presents bunch of graphics visualize csv data in different ways. using jquery validation plugin check csv file via 1) extension .csv, , 2) mime-type text/*.
this validates fine manually when upload .csv file, when try upload same file in selenium, mime-type error. there way "set" file input's mime-type, or should have that? missing file uploading in selenium? know i'm not supposed click file button , sending full path using send_keys().
i haven't found similar questions on or google. every selenium mime-type question deals downloading files during test, instead of uploading files.
thanks help!
my selenium test code:
file_input = self.browser.find_element_by_id('grade_file') file_input.send_keys('/<fullpath>/grades_deid.csv') grade_form = self.browser.find_element_by_tag_name('form') grade_form.submit()
the error during test:
my jquery validation code:
$(document).ready(function() { 'use strict'; // validate file input csv files allowed $('#grade_form').validate({ rules: { grade_file: { required: true, extension: "csv", accept: "text/*" } } }); });
updated: after playing around some, think due how chromedriver (not real chrome) handles file mimetypes...my csv file works fine firefox selenium webdriver. chromedriver , chrome use different mimetype sources? should same?
Comments
Post a Comment