这是HTML代码的一部分,描述了下面的下拉框。
<select id="f86_optReasonCodes" class="GTOptionMenu GTFillHorizontal optReasonCodes GTDisplay" onchange="this.changed=true;clientAPI.postEvent('f86_optReasonCodes',1);" onblur="looseFocus();" onfocus="gainFocus('f86_optReasonCodes');" size="1" name="f86_optReasonCodes" title="A list of outcomes to choose from" tabindex="10"></select>
<input id="f86_optReasonCodes_info" type="hidden" value="formID=86,objectID=2,componentType=5"></input>
id是动态的,因此我使用xpath来识别元素。我正在使用Thread方法减慢脚本。
Thread.sleep(10000);
//selenium.select("id=f95_optReasonCodes", "label=Complete Telephony");
selenium.select("XPath=//select[contains(@id, '_optReasonsCodes')]", "label=Complete Telephony");
selenium.click("css=option[value=\" Complete Telephony\"]");
我收到的错误消息如下。有人可以帮我这个吗?
com.thoughtworks.selenium.SeleniumException: ERROR: Element XPath=//select[contains(@id, '_optReasonsCodes')] not found