admin管理员组文章数量:1395264
I have a dropdowlist with the value "Lei" already selected, I need to get this text "Lei" and insert into a variable, how can I do it?
HTML
<dropdownlist _ngcontent-nnm-24="" id="tipoNorma" ng-reflect-itens="[object Object]" ng-reflect-id="tipoNorma" ng-reflect-selecionado="a4469d22-1188-467d-a78a-e385a2cc8eb9"><select class="form-control ng-valid ng-touched ng-dirty" ng-reflect-id="tipoNorma-select" id="tipoNorma-select" ng-reflect-disabled="false" ng-reflect-model="a4469d22-1188-467d-a78a-e385a2cc8eb9">
<option value="null">Selecione um tipo de norma...</option>
<option value="5980dfc1-ed08-4e5f-bdd7-144beb2fafe3" ng-reflect-value="5980dfc1-ed08-4e5f-bdd7-144beb2fafe3">Enunciado Orientativo</option>
<option value="e721782a-11ba-4828-ac3a-934f60652760" ng-reflect-value="e721782a-11ba-4828-ac3a-934f60652760">Instrução Normativa</option>
<option value="a4469d22-1188-467d-a78a-e385a2cc8eb9" ng-reflect-value="a4469d22-1188-467d-a78a-e385a2cc8eb9">Lei</option>
<option value="9d8ea2fd-efe9-410a-8062-f5607c56332d" ng-reflect-value="9d8ea2fd-efe9-410a-8062-f5607c56332d">Portaria</option>
<option value="8407a52d-a760-48a2-b780-ab93f5904565" ng-reflect-value="8407a52d-a760-48a2-b780-ab93f5904565">Provimento</option>
<option value="8b20cc7f-6be1-43a5-a0b7-ac2fe695b14c" ng-reflect-value="8b20cc7f-6be1-43a5-a0b7-ac2fe695b14c">Resolução</option>
<option value="8fe058a8-ece3-4ef5-8f74-17255a90066f" ng-reflect-value="8fe058a8-ece3-4ef5-8f74-17255a90066f">Súmula</option>
</select>
</dropdownlist>
I have a dropdowlist with the value "Lei" already selected, I need to get this text "Lei" and insert into a variable, how can I do it?
HTML
<dropdownlist _ngcontent-nnm-24="" id="tipoNorma" ng-reflect-itens="[object Object]" ng-reflect-id="tipoNorma" ng-reflect-selecionado="a4469d22-1188-467d-a78a-e385a2cc8eb9"><select class="form-control ng-valid ng-touched ng-dirty" ng-reflect-id="tipoNorma-select" id="tipoNorma-select" ng-reflect-disabled="false" ng-reflect-model="a4469d22-1188-467d-a78a-e385a2cc8eb9">
<option value="null">Selecione um tipo de norma...</option>
<option value="5980dfc1-ed08-4e5f-bdd7-144beb2fafe3" ng-reflect-value="5980dfc1-ed08-4e5f-bdd7-144beb2fafe3">Enunciado Orientativo</option>
<option value="e721782a-11ba-4828-ac3a-934f60652760" ng-reflect-value="e721782a-11ba-4828-ac3a-934f60652760">Instrução Normativa</option>
<option value="a4469d22-1188-467d-a78a-e385a2cc8eb9" ng-reflect-value="a4469d22-1188-467d-a78a-e385a2cc8eb9">Lei</option>
<option value="9d8ea2fd-efe9-410a-8062-f5607c56332d" ng-reflect-value="9d8ea2fd-efe9-410a-8062-f5607c56332d">Portaria</option>
<option value="8407a52d-a760-48a2-b780-ab93f5904565" ng-reflect-value="8407a52d-a760-48a2-b780-ab93f5904565">Provimento</option>
<option value="8b20cc7f-6be1-43a5-a0b7-ac2fe695b14c" ng-reflect-value="8b20cc7f-6be1-43a5-a0b7-ac2fe695b14c">Resolução</option>
<option value="8fe058a8-ece3-4ef5-8f74-17255a90066f" ng-reflect-value="8fe058a8-ece3-4ef5-8f74-17255a90066f">Súmula</option>
</select>
</dropdownlist>
Share
Improve this question
asked Aug 19, 2016 at 19:36
paulotarciopaulotarcio
4991 gold badge7 silver badges24 bronze badges
1 Answer
Reset to default 2You can locate the select
element and get the value of ng-reflect-model
attribute. Then, you can use this value in a follow-up selector to locate the option
value:
$("#tipoNorma-select").getAttribute("ng-reflect-model").then(function (value) {
$("option[ng-reflect-value='" + value + "']").getText().then(function (optionValue) {
console.log(optionValue);
});
});
本文标签: javascriptHow get the text from a select with ngreflectvalue using ProtractorStack Overflow
版权声明:本文标题:javascript - How get the text from a select with ng-reflect-value using Protractor? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744692540a2620079.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论