I'm trying to have my chrome extension automatically select a drop down option. I'm not sure if this is the best way to do it, but for my first step, I tackle the following html (top html is before selected state, second html line is after the selection is made):
html:
<md-select ng-disabled="!editIAreas || applicationReview.readOnly" ng-model="ia.iRecommendation" name="iRecommendation" aria-label="iRecommendation"
<md-select ng-disabled="!editIAreas || applicationReview.readOnly" ng-model="ia.iRecommendation" name="iRecommendation" aria-label="iRecommendation: No"
javascript plugin to change the first attribute:
document.querySelector('[aria-label="iRecommendation"]').setAttribute('aria-label', 'iRecommendation: No');
next attribute change:
class="ng-valid ng-touched ng-not-empty ng-dirty"
class="ng-valid ng-touched ng-not-empty ng-dirty ng-valid-parse"
changed with:
document.querySelector('[aria-label="iRecommendation"]').setAttribute('class', 'ng-valid ng-touched ng-not-empty ng-dirty ng-valid-parse');
The last thing I need to change (I believe) is this:
<b></b></div></span><span class="md-select-icon" aria-hidden="true"></span></md-select-value></md-select>
<b>Not Qualified</b></div></span><span class="md-select-icon" aria-hidden="true"></span></md-select-value></md-select>
How can I change the state of that? :O Am I even doing this right?
edit: here's more of the last:
<span><div class="md-text"><b>Not Qualified</b></div></span><span class="md-select-icon" aria-hidden="true"></span></md-select-value></md-select>
edit2: so i need to set the text of md-text between <b> and </b> how? I've been trying all day in console
what a headache. here is the solution:
document.querySelector("#select_value_label_2340 > span:nth-child(1) > div").innerHTML = 'Not Qualified';
I just had to look at the html and copy the js path... and use innerhtml... which may not be secure? idk. it works.
edit: nevermind. it doesn't work anymore. wtf
alright it's even worse than I thought. I'm working with an input container so the html isn't even exposed until I click on the thing. Is there an easier way to do this?