아니요, 아닙니다. 나는 너의 요점을 모르겠다. 미안. 나는 다중 선택 요소의 선택을 반전하기를 원한다면
어쨌든, 난 (페이지에서이 세 요소의 드롭 다운에 관하여 내가 전에 제공)과 같이 그것을 할 수 있습니다 :
storeSelectedIndexes | xpath=(//select[@name='jezyk'])[4] | selected
removeAllSelections | xpath=(//select[@name='jezyk'])[4]
store | ${selected} | selected2
store | javascript{storedVars['selected2'].split(',').length} | selectedNo
store | 999 | selectedIndexNo0
store | 999 | selectedIndexNo1
store | 999 | selectedIndexNo2
store | -1 | loop1
while | ${loop1} < (${selectedNo} - 1)
store | javascript{storedVars.loop1++}
store | javascript{storedVars['selected2'].split(',')[storedVars['loop1']]} | selectedIndexNo${loop1}
endWhile |
store | -1 | loop2
while | ${loop2} < 2
store | javascript{storedVars.loop2++}
gotoIf | ${loop2} == ${selectedIndexNo0} || ${loop2} == ${selectedIndexNo1} || ${loop2} == ${selectedIndexNo2} | dontSelect
addSelection | xpath=(//select[@name='jezyk'])[4] | index=${loop2}
label | dontSelect
endWhile |
을 그것은 가장 쉬운 방법이 아니다 , 나는 생각하지만, 작동합니다.
세 개의 다중 선택 요소에 적합합니다.
첫 번째 루프 (while - endWhile)는 선택된 인덱스를 추출하고 두 번째 루프는 이전에 선택된 인덱스를 제외한 모든 요소를 선택합니다.
좋아, 나는 몇 가지 변화를 만들어 스크립트의이 버전 (한 첫 번째 레이블 인덱스 = 0이 있기 때문에) 어떤 크기의 요소로 사용하기 괜찮습니다. 첫 번째 명령에서 검사 된 다중 형식에 대해 id 또는 xpath를 입력하고 요소에있는 모든 레이블의 수를 storeXpathCount 또는 단순히 그 수를 입력하여 제공하십시오. 그리고 다중 형식의 크기에 따라 "gotoIf"명령에 더 많거나 적은 조건을 추가하십시오. 스크립트의
2 버전 :
이
//store | put here id or xpath of your dropdown | elementID
store | xpath=(//select[@name='jezyk'])[4] | elementID
storeSelectedIndexes | ${elementID} | selected
removeAllSelections | ${elementID}
store | ${selected} | selected2
store | javascript{storedVars['selected2'].split(',').length} | selectedNo
//use custom xpath or explicitly type number of labels using simple "store" command instead of "storeXpathCount"
storeXpathCount | //div[@id='content']/div/div[2]/div[31]/div/select/option | elementSize
store | -1 | loop0
while | ${loop0} < ${elementSize}
store | javascript{storedVars.loop0++}
store | 999 | selectedIndexNo${loop0}
endWhile |
store | -1 | loop1
while | ${loop1} < (${selectedNo} - 1)
store | javascript{storedVars.loop1++}
store | javascript{storedVars['selected2'].split(',')[storedVars['loop1']]} | selectedIndexNo${loop1}
endWhile |
store | -1 | loop2
while | ${loop2} < (${elementSize} - 1)
store | javascript{storedVars.loop2++}
//depending on size of your multiform element you have to add more conditions to below "gotoIf" command. At the moment it's good for three elements (labels)
gotoIf | ${loop2} == ${selectedIndexNo0} || ${loop2} == ${selectedIndexNo1} || ${loop2} == ${selectedIndexNo2} | dontSelect
addSelection | ${elementID} | index=${loop2}
label | dontSelect
endWhile |
이해가 안 - 어떻게 * 반전 * 현재의 선택에 가정 두 가지 선택을 추가? – l0b0