HtmlList: Select options in a select with padding -


i using property selecteditemsasstring htmllist object select multiple items in select-tag.

myhtmllist.selecteditemsasstring = new string[] {"a"}; 

this works expected in demo, not in productive website, because there select-tag has left padding.

<select multiple="multiple" style="padding-left: 12px; width: 400px;">     <option>a</option>     <option>b</option>     <option>c</option> </select> 

this results in mouse click far left of actual option , therefor no option selected. ideas how can make work without removing padding?

you right. seems codedui bug me. instead of clicking list item control, clicks on top left corner of selected item row.

as alternative can click , select items ourselves.

var selecteditems = new string[] { "a", "c" };  // clear existing selections myhtmllist.selectedindices = new int[] { };  // select items myhtmllist.getchildren().cast<htmllistitem>().tolist().foreach(f => {     keyboard.pressmodifierkeys(modifierkeys.control);     if (selecteditems.contains(f.displaytext))     {         mouse.click(f);     }     keyboard.releasemodifierkeys(modifierkeys.control); }); 

above code find children of htmllist, cast them htmllistitem. selection start pressing "ctrl" key, , each list item if display text matches selected item list, click on list item. @ end release "ctrl" key.

if there lots of htmllist items in application, suggest converting extension method htmllist.

something this.

public static void selectitems(this htmllist htmllist, string[] selecteditems) 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -