I am new to the Selenium Web Driver technology, below is my question and unable to find out the solution please any one help me to find out the by x path or by cs Selector or by name.
below is code is the drop down Element in the page,
<div id="reportsManager_chzn" class="chzn-container chzn-container-single chzn-container-active" style="width: 220px;">
<a class="chzn-single" href="javascript:void(0)" tabindex="-1">
<span>Ajay Paul Chowdhury</span>
<div>
<b></b>
</div>
</a>
<div class="chzn-drop" style="left: -9000px; width: 218px; top: 24px;">
<div class="chzn-search">
<input type="text" autocomplete="off" style="width: 183px;">
</div>
<ul class="chzn-results">
<li id="reportsManager_chzn_o_1" class="active-result" style="">All</li>
<li id="reportsManager_chzn_o_2" class="active-result" style="">wer</li>
<li id="reportsManager_chzn_o_3" class="active-result" style="">sss</li>
<li id="reportsManager_chzn_o_4" class="active-result result-selected" style="">www</li>
<li id="reportsManager_chzn_o_5" class="active-result" style="">rrr</li>
<li id="reportsManager_chzn_o_6" class="active-result" style="">yyy</li>
<li id="reportsManager_chzn_o_7" class="active-result" style="">iii</li>
<li id="reportsManager_chzn_o_8" class="active-result" style="">ooo</li>
<li id="reportsManager_chzn_o_9" class="active-result" style="">ppp</li>
for the above code unable to find out the xpath/cssselector/name for the so that i can Dynamically Select the any dropdown value from the List
Please any one help me to find out the result.
for above code i tried
1) try 1
// by Xpath and it selects the list by list ID
Actions manager = new Actions(driver);
WebElement we1=driver.findElement(By.xpath("//[@id='reportsManager_chzn_o_23']"));
manager.moveToElement(we1).moveToElement(driver.findElement(By.xpath("//[@id='reportsManager_chzn_o_3']"))).click().build().perform();
Thread.sleep(3000);
above Selenium code will Select the dropdown element 'sss' i need code which select by name so that i can paramaterize the Dropdown List
2) try 2
driver.findElement(By.id("reportsManager_chzn")).findElement(By.cssSelector("chzn-single")).findElement(By.name("sss")).click();
showing the error message
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"chzn-single"}
and the Selenium testcase is failed
3) try 3
tried by Select
Select selectBox = new Select(driver.findElement(By.id("reportsManager_chzn")));
selectBox.selectByVisibleText("sss");
for the above shows the Error message found div instead of select
also i tried in all the way, finally i'm here
Thanks in advance