Can someone please assist me?
I am having trouble selecting an element because when I hover/click on the dropdown id='rfdSubMenu1396697749612'
, it becomes visible. If I move the cursor away, it becomes hidden.
However, when I try to run the code below, I get an error saying 'No such element id='rfdSubMenu1396697749612''. How can I make it visible and select an option?
The junit code was generated from Selenium IDE
driver.findElement(By.id("ctl00_InventoryContent_btnAddSystem")).click();
driver.findElement(By.id("ctl00_InventoryContent_txtAssetName")).clear();
driver.findElement(By.id("ctl00_InventoryContent_txtAssetName")).sendKeys("ASDE346");
driver.findElement(By.id("ctl00_InventoryContent_txtControlNumber")).clear();
driver.findElement(By.id("ctl00_InventoryContent_txtControlNumber"))
.sendKeys("ASDE346");
driver.findElement(By.cssSelector("span.rfdSelectText")).click();
driver.findElement(By.xpath("//div[@id='rfdSubMenu1396538734351']/ul/li[2]")).click();
new Select(driver.findElement(By.id("ctl00_InventoryContent_ddlAssetType")))
.selectByVisibleText("Networking");
driver.findElement(By.cssSelector("#Skinnedctl00_InventoryContent_ddlAssetStatus > span.rfdSelectOuter > span.rfdSelectText")).click();
driver.findElement(By.xpath("//div[@id='rfdSubMenu1396538761911']/ul/li[3]")).click();
new Select(driver.findElement(By.id("ctl00_InventoryContent_ddlAssetStatus"))).selectByVisibleText("InActive");
Changes Made in Junit code
driver.findElement(By.cssSelector("span.rfdSelectText")).click();
// Next line causes 'No such Element Present' Error
WebElement dis = driver.findElement(By.cssSelector("html.RadForm body div#rfdSubMenu1396685935145.rfdSelectBox"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("rfdSelect_selected.click()" , dis);
new Select(driver.findElement(By.id("ctl00_InventoryContent_ddlAssetStatus"))).selectByVisibleText("InActive");
HTML CODE
<div id="rfdSubMenu1396697749612" class="rfdSelectBox rfdSelectBox_Default"
style="overflow-y: auto; width: 149px; position: absolute; visibility: hidden; left:
885px; top: 277px; display: none;">