请帮助我从量角器的单元格中选择下拉值。
顺便说一句,它是一个无角度的网站
HTML示例:
<td data-cellid="RequiredContentTypeId" class="customGridDataCell customGridEditCell" tabindex="-1" xpath="1">
<div data-cellid="RequiredContentTypeId" class="valueContainer">
<select name="RequiredContentTypeId">
<option> </option>
<option value="bd434f35-90db-e911-aa59-a96c125b4266">AddtoTest</option>
<option value="e8b6fd1b-e2f3-e911-aa64-e16c52c442dc">APINV_EPIC06</option>
<option value="35cfdd50-c47a-e911-aa37-8fe9ba6f0d87">Approve</option>
<option value="70da50aa-e2a3-e911-aa45-8f65b76e1edb">Basic</option>
<option value="5af85ad8-5ac0-e911-aa4f-b51108e06dbe">cont</option>
<option value="1c9b4449-90db-e911-aa59-a96c125b4266">Contentgenrat</option>
<option value="7ea80473-ecdd-e911-aa5b-cc08702b7e65">CTB1</option>
<option value="fb0b16cb-5fc9-4938-8cdb-b28b0ac3a065">Default</option>
<option value="5b904ca0-8adb-e911-aa59-a96c125b4266">delete</option>
<option value="9cd4dc48-910b-ea11-aa6c-879f4a104148">GP - US Expense Report</option>
<option value="7a87e6ae-75b3-e911-aa4b-a33f065bbcc1">INVOICE</option>
<option value="2860a55d-90db-e911-aa59-a96c125b4266">norconnoradd</option>
<option value="df57386a-90db-e911-aa59-a96c125b4266">olaa</option>
<option value="f299ad9c-91db-e911-aa59-a96c125b4266">qwerty</option>
<option value="2fa1a597-63d9-e911-aa59-a96c125b4266">Test1</option>
<option value="14d4d010-5bc0-e911-aa4f-b51108e06dbe">ton</option>
<option value="4e0506f8-bd7a-e911-aa37-8fe9ba6f0d87">View</option>
<option value="15086a03-ebc8-e911-aa54-ce643b10106b">WithNavFieldGroup</option>
</select>
</div>
下面是我尝试过的内容,它显示无法选择定位器。
await rows[rowNumber].all(by.tagName("td"))
.get(0)
.element(by.xpath("//select"))
.element(by.cssContainingText("option", value))
.click();
答案 0 :(得分:1)
您要选择哪个选项?
可以使用量角器的方法之一轻松完成此操作:
element(by.cssContainingText('option', 'AddtoTest'));
答案 1 :(得分:0)
已经提到了按文本选择值,如果要按订单号选择,请按以下步骤操作
await $('.valueContainer select').click();
await $$('.valueContainer select option[value]').get(0).click();