는 또한 E2E 테스트 일하고, 나는 드롭 다운 옵션을 선택하기 위해 여러 가지 기능을 가지고 :
이 값 드롭 다운을 선택합니다.
this.selectDropdownByLabel = function (dropdownElement, label) {
return this.selectDropdownByAttribute(dropdownElement, 'label', label);
};
:
this.selectDropdownByPartialLabel = function (dropdownElement, partialLabel) {
return this.selectDropdownByAttribute(dropdownElement, 'label', partialLabel, true);
};
가 레이블로 드롭 다운을 선택
this.selectDropdownByIndex = function (dropdownElement, index) {
dropdownElement.click();
dropdownElement.all(by.css('option')).get(index).click();
};
아래 부분 라벨에 의해 드롭을 선택
this.selectDropdownByValue = function (dropdownElement, value) {
return this.selectDropdownByAttribute(dropdownElement, 'value', value);
};
인덱스에 의해 드롭 다운 선택 그리고 내부에서 사용되는 기능 각 드롭 다운 기능은 다음과 같습니다.
this.selectDropdownByAttribute = function (dropdownElement, attribute, value, partial, index) {
var pathModifier = '';
if (typeof index === 'undefined') {
index = 0;
}
if (typeof partial === 'undefined') {
partial = false;
}
if (partial) {
pathModifier = '*';
}
dropdownElement.click().then(function() {
dropdownElement.all(by.css('option[' + attribute + pathModifier + '="' + value + '"]')).get(index).click();
});
};
이 정보가 도움이되기를 바랍니다. 드롭 다운과 상호 작용 할 때