I am sending text to Dropdown textbox from Excel file.So it should send text to dropdown textbox and will select the visible particular matched text.
This is the HTML code:
<div id="routingPanelLeft">
<p style="margin-bottom: 1em">Selecting an item will append to end of hierarchy</p>
<div id="srlSelectContainer">
<p>Select an SRL:</p>
<select id="srlSelect" class="routing-select" style="display: none;">
<option/>
<option value="11">AS-HTTS-US-CDN</option>
<option value="20">AS-HTTS-US-CORE</option>
<option value="19">AS-HTTS-US-HW</option>
<option value="15">AS-HTTS-US-LAN-SW</option>
<option value="8">AS-HTTS-US-NMS</option>
<option value="13">AS-HTTS-US-RP</option>
<option value="14">AS-HTTS-US-SEC</option>
<option value="12">AS-HTTS-US-VOICE</option>
<option value="16">AS-HTTS-US-Wireless</option>
<option value="7">AS-HTTS-WANSW</option>
<option value="22">AS-US-Unsupported-KW</option>
<option value="50">ATT-INDIA-KWL</option>
<option value="33">ATT-KWL</option>
<option value="63">BELL-IPCC-UC</option>
<option value="52">BWI-GMBH-KWL</option>
<option value="65">CISCO_IT_HTTS</option>
<option value="27">EM1-KWL</option>
<option value="29">EM2-KWL</option>
<option value="36">EMC_SOS</option>
<option value="6">HTTS</option>
<option value="55">HTTS-AMAZON</option>
<option value="57">HTTS-CNS-KWL</option>
<option value="35">HTTS-COMCAST</option>
<option value="350">HTTS-Charter</option>
<option value="25">HTTS-EUEM</option>
<option value="58">HTTS-HSBC</option>
<option value="61">HTTS-HSBC-NCMKW</option>
<option value="43">HTTS-IOX</option>
<option value="42">HTTS-IPCC</option>
<option value="47">HTTS-IPCC-VZW</option>
<option value="68">HTTS-IT</option>
<option value="269">HTTS-MICROSOFT-SP</option>
<option value="60">HTTS-MSGNS</option>
<option value="56">HTTS-Mobility</option>
<option value="24">HTTS-Optus</option>
<option value="54">HTTS-PlatinumPlus</option>
<option value="51">HTTS-RPLAN-RNT</option>
<option value="53">HTTS-RUSSIAN</option>
<option value="49">HTTS-SP</option>
<option value="44">HTTS-SV</option>
<option value="45">HTTS-SVTAC</option>
<option value="26">HTTS-TEST</option>
<option value="10">HTTS-UCC</option>
<option value="66">HTTS-VIDEO</option>
<option value="48">HTTS-VTACPCMM</option>
<option value="41">HTTS-WAN</option>
<option value="70">HTTS-WANSW</option>
<option value="289">HTTS-WIRELESS</option>
<option value="34">HTTS_DT</option>
<option value="369">Jabber Support</option>
<option value="290">LATAM-HTTS</option>
<option value="309">LATAM-HTTS-EMEAR</option>
<option value="2">Lan Switching</option>
<option value="59">MDS_WW-SAN</option>
<option value="3">MultiService Specialization Queues</option>
<option value="64">Nexus-Amzn-kwl</option>
<option value="30">SEG1-KWL</option>
<option value="4">Security</option>
<option value="249">TSA</option>
<option value="62">TWC-SP</option>
<option value="37">VZB_APAC</option>
<option value="38">VZB_EMEA</option>
<option value="39">WW-SOS</option>
<option value="40">WW-SOS-CIM_CR2</option>
<option value="32">WW-SOS-HTTS</option>
<option value="31">WW-SOS-TAC</option>
<option value="46">htts-nexus7k</option>
<option value="389">test_1234</option>
</select>
<span class="custom-combobox">
<span class="ui-helper-hidden-accessible" role="status" aria-live="polite">45 results are available, use up and down arrow keys to navigate.</span>
<input class="custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left ui-autocomplete-input" title="" autocomplete="off"/>
<a class="ui-button ui-widget ui-state-default ui-button-icon-only custom-combobox-toggle ui-corner-right" tabindex="-1" title="Show All Items" role="button" aria-disabled="false">
<span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"/>
<span class="ui-button-text"/>
</a>
</span>
</div>
<ul id="ui-id-2" class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-corner-all" tabindex="0" style="display: block; width: 282px; top: -227.3px; left: 268.8px;">
<li class="ui-menu-item" data-type="undefined" data-id="11" role="presentation">
<a id="ui-id-27599" class="ui-corner-all" tabindex="-1">AS-HTTS-US-CDN</a>
</li>
<li class="ui-menu-item" data-type="undefined" data-id="20" role="presentation">
<a id="ui-id-27600" class="ui-corner-all" tabindex="-1">AS-HTTS-US-CORE</a
</ul>
I have tried Select, Keys, Action class, SendKeys methods. But it is not selecting the value from the dropdown. It is sending text to the textbox , which shows results matching text options from which it should select the Value that I am sending from Excel file.
These are my efforts: WebDriverWait wait11 = new WebDriverWait(driver,5); wait11.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//[@id='srlSelectContainer']/span/input"))).click(); driver.findElement(By.xpath("//[@id='srlSelectContainer']/span/input")).sendKeys(testData);
/*WebDriverWait wait11 = new WebDriverWait(driver,5);
wait11.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='srlSelectContainer']/span/input"))).sendKeys(testData);
WebDriverWait wait1= new WebDriverWait(driver,5);
wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='srlSelectContainer']/span/input"))).sendKeys(Keys.ARROW_DOWN,Keys.ENTER);
WebDriverWait wait2= new WebDriverWait(driver,5);
wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='srlSelectContainer']/span/input"))).clear();
*/
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='srlSelectContainer']/span/input"))).click();*/
WebDriverWait wait2= new WebDriverWait(driver,5); wait2.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//[@id='srlSelectContainer']/span/input"))).sendKeys(testData); driver.findElement(By.xpath("//[@id='srlSelectContainer']/span/input")).sendKeys(Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ARROW_DOWN,Keys.ENTER);
Please suggest me any way as it is a roadblock.
Aucun commentaire:
Enregistrer un commentaire