Been having some trouble with some phantomjs code I'm trying to run. In theory, the code should be able to select an option from the below dropdown menu.
<select name="Budget_Ctr2" size="1" onchange="JavaScript:Submitthis('Budget_Ctr2')" id="Budget_Ctr2">
<option selected="selected" value="CAAH">CAAH</option>
<option value="CAFLS">CAFLS</option>
<option value="CECAS">CECAS</option>
All of the code works, except when I get to the following snippet:
var sel = document.getElementById('Budget_Ctr2');
var opts = sel.options;
Everything I've read on stack so far has made me think this should work. However, when I run the program, I get "TypeError: null is not an object (evaluating 'sel.options'). I'm fairly confident 'sel' itself isn't null based on a few test, but I can't reconcile the error with what's going on. Not super experienced with javascript outside of phantomjs, but anyone have any ideas?