Below is a snippet of HTML code:
<div class="k-list-scroller" unselectable="on" style="height: auto;">
<ul unselectable="on" class="k-list k-reset" tabindex="-1" aria-hidden="true" id="AdmittedFromId_listbox" aria-live="off" data-role="staticlist" role="listbox">
<li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="0">Physician/Hm w/o HH</li>
<li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="1">Ad Fr Hospital</li>
<li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="2">Ad fr SNF</li>
<li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="3">Admit fr OthFacility</li>
<li tabindex="-1" role="option" unselectable="on" class="k-item" data-offset-index="4">Ad Court Ordered</li>
</ul>
</div>
I've made several attempts to interact with the element, without success:
IWebElement admittedFrom = Driver.ngInstance.FindElement(By.XPath("//input[@id='AdmittedFromId']"));
IJavaScriptExecutor admittedFromExecutor = (IJavaScriptExecutor)Driver.ngInstance;
admittedFromExecutor.ExecuteScript("arguments[0].click();", admittedFrom);
admittedFromExecutor.ExecuteScript("document.getElementByID('AdmittedFromId_listbox').data-offset-index='1';");
IWebElement admittedFrom = Driver.ngInstance.FindElement(By.XPath("//input[@id='AdmittedFromId']"));
IJavaScriptExecutor admittedFromExecutor = (IJavaScriptExecutor)Driver.ngInstance;
admittedFromExecutor.ExecuteScript("arguments[0].click();", admittedFrom);
admittedFromExecutor.ExecuteScript("arguments[0].setAttribute('data-offset-index',arguments[1])", admittedFrom, "1");
Despite various attempts, I am unable to successfully modify the value. Any assistance would be greatly appreciated.