How to record/use selenium handling combobox and choose item used by dijit?
is it any easier way using selenium to click on combobox written by dijit and choose item from list?
source:
<div id="widget_ofertaForm_offerElements_1_" class="dijit dijitReset dijitInlineTable dijitLeft AreaStd dijitComboBox" tabindex="-1" wairole="combobox" dojoattachpoint="comboNode" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse" role="combobox" style="width: 420px;" widgetid="ofertaForm_offerElements_1_">
<div style="overflow: hidden;">
<div class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton" dojoattachevent="onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:_onMouse,onmouseleave:_onMouse" wairole="presentation" dojoattachpoint="downArrowNode" role="presentation">
<div class="dijitArrowButtonInner"> </div>
<div class="dijitArrowButtonChar">ˇ</div>
</div>
<div class="dijitReset dijitValidationIcon">
<br>
</div>
<div class="dijitReset dijitValidationIconText">?</div>
<div class="dijitReset dijitInputField">
<input id="ofertaForm_offerElements_1_" class="dijitReset" type="text" waistate="haspopup-true,autocomplete-list" wairole="textbox" dojoattachpoint="textbox,focusNode" dojoattachevent="onkeypress:_onKeyPress,compositionend" autocomplete="off" role="textbox" aria-haspopup="true" aria-autocomplete="list" aria-invalid="false" tabindex="0" aria-required="true" value="HTC TOUCH DUAL CZARNY - 1382.95 PLN 16 szt. ( 1701.03 PLN Z VAT) A (+01101100)">
<input type="hidden" name="offerElements[1]" value="#_01101100#MATERIAL_BONUS">
</div开发者_如何学Go>
i know that there aren't here any items, but when i click on combobox, they really show themselves.
I tried to use selenium IDE. So i wrote:
selenium.clickAt("class=dijitArrowButtonInner","100");
and it worked. However only for selenium IDE, but while working with junit i got message "element not found".
I will appreciate for any help.
ps. please correct my english/title if it is not correct. Sorry.If you want to select some item from that kind of combobox, you need to know, which element you want to select (e.g. id, class, some other attributes). After that you need to click at the select control
selenium.click("div.dijitArrowButtonChar");
Then, you need to wait, until the element you need to select show.
selenium.waitForCondition("selenium.isElementPresent(\""+selector_for_element+"\")", "1000");
Where "selector_for_element" is a selector for the element you need to select. Like, "div.selectItem:last()".
After element is show, you need to click on it:
selenium.click(selector_for_element);
Code for Selenium 1.0.
精彩评论