I am working on a site that has a form and the user is supposed to upload a photo on the site. The form checks the heigh weight and size of the image to make sure it is large. I have a bot that is running on the site and is getting stuck because some of the images it puts are too small. For my purposes, I want to be able to override the JavaScript on the source of the page from my selenium script written in Python, so that when I submit a small file it just goes through anyway.
Here is a screenshot of the JavaScript source code:

I am not able to directly edit this but I was able to set a break point before the if statement in the developer tools and then write "h=300;","w=300;", and "size=300;: to get it to work, however I basically need to be able to do this from within selenium using the webdriver.
I was able to get what I want working from within Chrome itself with a breakpoint and manually entering the variables to be different but I couldn't figure out how to do it from within my bot. This how I set up my driver:

I have looked all over the internet and couldn't find anything on the topic. It seems like this would be something that would work well with a content script if I had a Chrome extension, however this project took me hours and it would be a shame if I had to rewrite everything in JavaScript and then make an extension just for this. If there is a simple way to do that though I would be all ears.