In web-code I have a button:
<div id="net-equipment-button_config-1037" class="x-btn x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" style="margin: 0pt; left: 321px; top: 0px;">
<em id="net-equipment-button_config-1037-btnWrap" class="x-btn-split x-btn-split-right">
<button id="net-equipment-button_config-1037-btnEl" class="x-btn-center" autocomplete="off" role="button" hidefocus="true" type="button" aria-haspopup="true">
<span id="net-equipment-button_config-1037-btnInnerEl" class="x-btn-inner" style="">Конфигурация</span>
<span id="net-equipment-button_config-1037-btnIconEl" class="x-btn-icon x-hide-display"> </span>
</button>
</em>
</div>
If I just do by selenium click on css=#net-equipment-button_config-1037-btnWrap, a default item selected from this button, but I wanna choose another item not default, how can I do this?
P.S: This button it’s a splitbutton which select default item by press on it and dropdown menu if click on a arrow
Without seeing this displayed in the browser and the CSS it is a little difficult to know for sure, but assuming that I understand it and it works the way I think it works I have a solution. You could click with offset to make it click the arrow. Selenium automatically clicks in the center of an element. You can determine how wide the button is and give the x offset as width/2 – 5 (so it will click 5 pixels from the right edge of the button). The code in C# for selenium 2 + webdriver would be this:
int xOffset = buttonWidth/2 – 5;
Actions builder = new Actions(webDriver);
builder.MoveToElement(element, xOffset, 0);
builder.Click();