In my application left-hand side menu bar which contain 8 modules of an application. And each of module contain suboptions.
I am trying to click on one of suboption from a particular module which having 30 suboptions(pages).
But after clicking on a particular option the popup window remains as it is on screen and it does not allow me to click the options which are behind the popup screen.
Behind popup screen the dropdown option is there and want to select one option from that dropdown.
Its giving me an error "org.openqa.selenium.JavascriptException: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite."
Here is the code
//div[#id='main-nav']/ul --Gives me 6 modules name(6 ul):
<ul class="main-nav-gray-border user-details-menu-tab left-nav-main-menu-container left-nav-img-ul" xpath="1"></ul>
<ul class="main-nav-gray-border menu-items-main-menu-list left-nav-main-menu-container left-nav-img-ul" xpath="2">
<li class="main-nav-img-label" id="admin-nav">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="main-nav-icons"></svg>
<label>
Analytics
</label>
<ul class="nav-items admin-menu-items" style="top: 50px;" id="admin-menu-items">
<li class="side-nav-titles"></li>
<a class="module-item-child selected-nav-item" href="#" id="QualityMeasures37" onclick="loadModule('Analytics/Index?dashboardUrlId=71', 2,'QualityMeasures', 37,null,'Quality Measures')" xpath="1">
<li>**Quality Measures**</li>
</a>
<a class="module-child " id="QualityMainView38" onclick="loadModule('Analytics/Index?dashboardUrlId=93', 2,'QualityMainView', 38,null,'Quality Main View')"></a>
<a class="module-child " id="QualityRanking39" onclick="loadModule('Analytics/Index?dashboardUrlId=94', 2,'QualityRanking', 39,null,'Quality Ranking')"></a>
<a class="module-child " id="QualityTrending40" onclick="loadModule('Analytics/Index?dashboardUrlId=95', 2,'QualityTrending', 40,null,'Quality Trending')"></a>
<a class="module-child user-default-module selected-nav-item" href="#" id="DetailedFinanceAndUtilization41" onclick="loadModule('Analytics/Index?dashboardUrlId=76', 2,'DetailedFinanceAndUtilization', 41,null,'Detailed Finance & Utilization')"></a>
<a class="module-child " id="DetailedFinanceandUtilizationPro42" onclick="loadModule('Analytics/Index?dashboardUrlId=77', 2,'DetailedFinanceandUtilizationPro', 42,null,'Detailed Finance & Utilization Professional')"></a>
<a class="module-child " id="PartAClaimsAnalysis43" onclick="loadModule('Analytics/Index?dashboardUrlId=87', 2,'PartAClaimsAnalysis', 43,null,'Facility Claims Analysis')"></a>
</ul>
</li>
</ul>
<ul class="main-nav-gray-border menu-items-main-menu-list left-nav-main-menu-container left-nav-img-ul" xpath="3"></ul>
<ul class="icon-minimizer" id="minimizer-nav" xpath="7"></ul>
This the code for a drop down menu.
<div class="dd-select" style="width: 100px; background: rgb(245, 245, 245);" xpath="1">
<input class="dd-selected-value" type="hidden" value="Level1"><a class="dd-selected"><label class="dd-selected-text" title="Enterprise">Enterprise</label></a>
<span class="dd-pointer dd-pointer-down"></span></div>
This is the code to select the option from drop down menu.
<div id="SelectedHierarchyLevelName" class="dd-container" style="width: 100px;" xpath="1">
<div class="dd-select" style="width: 100px; background: rgb(245, 245, 245);">
<input class="dd-selected-value" type="hidden" value="Level3">
<a class="dd-selected">
<label class="dd-selected-text" title="Facility">**Facility**</label></a>
<span class="dd-pointer dd-pointer-down dd-pointer-up"></span></div>
<ul class="dd-options dd-click-off-close" style="min-width: 100px; height: 150px; overflow: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 6px 16px; display: block;">
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Level1"> <label class="dd-option-text">Enterprise</label></a></li>
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Level2"> <label class="dd-option-text">Ministry</label></a></li>
<li class=""><a class="dd-option dd-option-selected"> <input class="dd-option-value" type="hidden" value="Level3"> <label class="dd-option-text">Facility</label></a></li>
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Level4"> <label class="dd-option-text">Med Group/Division</label></a></li>
<li class="hideMe"><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Missing Providers"> <label class="dd-option-text">Missing Providers</label></a></li>
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Help"> <label class="dd-option-text">Help</label></a></li>
<li class="hideMe"><a class="dd-option"> <input class="dd-option-value" type="hidden" value="L0Simulation"> <label class="dd-option-text">Unknown Simulation</label></a></li></ul></div>
I tried following:
#FindBy(id="admin-nav")
WebElement mouseHover;
#FindBy(xpath="//a[#id='QualityMeasures37']//li[contains(text(),'Quality Measures')]")
WebElement btnQualityMeasure;
#FindBy(xpath="//div[#id='SelectedHierarchyLevelName']//span[#class='dd-pointer dd-pointer-down']")
WebElement dropDown;
#FindBy(xpath="//label[contains(text(),'Facility')]")
WebElement facilityOption;
public void hoverTest() throws Exception
{
Actions act = new Actions(driver);
act.moveToElement(mouseHover).build().perform();
Thread.sleep(2000);
// ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", btnQualityMeasure);
// Thread.sleep(1000);
act.moveToElement(btnQualityMeasure).click().build().perform(); //clicking on suboption
Thread.sleep(10500);
}
public void clickDropDownButton()
{
Actions act = new Actions(driver);
act.moveToElement(dropDown).click().build().perform();
}
public void selectFromDropDown() throws Exception{
Actions act1 = new Actions(driver);
// ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", ministryOption);
// Thread.sleep(1000);
act1.moveToElement(ministryOption).click().build().perform();
Thread.sleep(1500);
//The first method Mousehover it and select the desired suboption.
Second method clicking on dropdown button and 3rd method selecting the option from drop down.
In short from the 'Analytics' module the suboption 'Quality Measure' should be select and on that page click on one drop down menu and select the option 'Facility'. I highlighted as bold all 3 in my above code.
Its giving me an eroor "Its giving me an error "org.openqa.selenium.JavascriptException: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite."
Also some time it does not open the desired suboption.
Any help will be appreciated.
I need to automate some website with vbscript. In here as shown below have some jstree unordered list with list items.
<div id="categoryTree" class="category-treeview jstree jstree-1 jstree-default" role="tree" aria-activedescendant="cat35">
<ul class="jstree-container-ul jstree-children">
<li role="treeitem" aria-expanded="false" id="cat001" class="jstree-node jstree-closed">
<i class="jstree-icon jstree-ocl"></i>
<a class="jstree-anchor" href="#"><i class="jstree-icon jstree-themeicon jstree-themeicon-custom" style="background-image: url("abc/9174db8b-e42f-41c8-928d-a60c83f3e094.JPG"); background-position: center center; background-size: auto;"></i>A Web Services (AWS)</a>
</li>
<li role="treeitem" aria-expanded="false" id="cat002" class="jstree-node jstree-closed"></li>
<li role="treeitem" aria-expanded="false" id="cat003" class="jstree-node jstree-closed"></li>
</ul></div>
Ihave try to expand list item using below vbscript code snippet.
Set btnTreeListItem = IE.document.getElementById("cat001")
btnTreeListItem.Click
But It's nothing happen. So how to do that accordingly?
Thanks.
Regards.
Assuming it is the a tag that needs clicking then try using a css class selector to target that tag by className
ie.document.querySelector(".jstree-anchor").click
I am using bootstrap menu on a web page.
my menu list looks something like this:
<li><a class="nav-link dropdown-toggle" href="#" id="navbarDropdown"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-
expanded="false">main item
<span class="pull-left glyph-btn-menu">
<em class="glyphicon glyphicon-menu-down"></em>
</span>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
sub item1<br>
sub item2<br>
sub item2<br>
</div>
</li>
I want glyphicon symbol to change to class glyphicon-menu-up when nav-link is clicked and submenu items open and then again to change back to glyphicon-menu-down when nav-item is closed or when a different nav-item is clicked.
What would be the best way to acheive that
So this is my solution.
I gave the parent ul the an id value: id="theme"
bootstrap adds the class open to an open li so I check to see if any li have the class open, remove and add glyphicon classes as needed
$('#theme li').click(function () {
if($(this).hasClass('open')){
//alert('aaa');
$(this).children('a').children('span').children('em').removeClass('glyphicon-menu-up');
$(this).children('a').children('span').children('em').addClass('glyphicon-menu-down');
} else {
$(this).children('a').children('span').children('em').removeClass('glyphicon-menu-down');
$(this).children('a').children('span').children('em').addClass('glyphicon-menu-up');
}
});
I have a Menu which have li
(list) elements which gets enabled after you mouse-hover a particular label.
driver.get("www.snapdeal.com"); Actions actions = new Actions(driver);
actions.moveToElement(driver.findElement(By.id("loggedOutAccount"))).build().perform();
//Wait for 5 Secs
driver.findElement(By.className("accountLink")).click();// Here it's throwing Element not visible exception
This code is doing the mouse-hover properly but not able to click the "SignIn Link" Link. Though on manually checking the element is Visible
DOM Structure -
<div id="loggedOutAccount" class="hd-rvmp-logout">
<a class="signIn" href="javascript:void(0);">
<i class="iconHeader accountUser"></i>
<label class="my-account-lang"> My Account</label>
<i class="mar_2_left right-downArrow breadcrumbArrow-down"></i>
</a>
<div class="sdNavDropWrapper accDetails" style="display: none; z-index: 999;">
<ul class="positionAbsolute pull-right">
<li class="customLoggedInState">
<div class="left triangle"></div>
<div class="right triangle"></div>
<div>
<a class="accountLink" href="javascript:void(0);">Click here to sign in ></a>
</div>
</li>
<li class="stop-event">
<li class="stop-event">
<li class="stop-event">
<li class="stop-event">
<li class="stop-event">
</ul>
</div>
</div>
Please use xpath for both element like below :
driver.get("www.snapdeal.com");
Actions actions = new Actions(driver);
actions.moveToElement(driver.findElement(By.xpath("yourxpathhere"))).build().perform();
driver.findElement(By.xpath("yourxpathhere")).click();
I think class/Id repeating for other elements also for style purpose. so Xpath is better to find unique element.
HTML Code for the drop down with 3 constant values:
<div class="a-popover-inner" style="height: auto; overflow-y: auto; min-width: 107px; width: auto;">
<ul id="3_dropdown_combobox" class="a-nostyle a-list-link" aria-multiselectable="false" role="listbox" tabindex="-1">
<li class="a-dropdown-item status-option" role="option" tabindex="0">
<li class="a-dropdown-item status-option" role="option" tabindex="0">
<a class="a-dropdown-link a-active" data-value="{"stringVal":"Active"}" href="javascript:void(0)" tabindex="-1"> Active </a>
</li>
<li class="a-dropdown-item status-option" role="option" tabindex="0">
</ul>
Tried:
driver.findElement(By.xpath("//*[#id='status-select']/span/span"));
Result:
Able to click/select the dropdown successfully
But Unable to further select a specific dropdown
Try1:
driver.findElement(By.xpath("//*a[#data-value={'stringVal':'Active'}]")).click();
Result1:InvalidSelectorError: Unable to locate an element with the xpath expression
Try2:
java.util.List<WebElement> elements = driver.findElements(By.xpath("//*[#id='status-select']/span/span"));
Result3: count = element.size(); // prints count as 1
//so cant get elements[element.count-1];
Try3:
Select select = new Select(driver.findElement(By.id("3_dropdown_combobox")));
select.selectByVisibleText("Expired");
Result3:
Try4:
driver.findElement(By.xpath("//*[#id='3_dropdown_combobox']/li[2]/a")).click();
(or)
java.util.List<WebElement> elements = driver.findElements(By.id("3_dropdown_combobox"));elements.size();
Result4: console does nothing for >10min. I stop the execution
Please Guide me on what is correct way to select 2nd/3rd dropdown options
Do this:
Select select = new Select(driver.findElement(By.id("status-select")));
select.selectByIndex(1); //Selects the 2nd option in the dropdown list
In order to click the Active link this should work for you:
driver.findElement(By.xpath("//*[#id="3_dropdown_combobox"]/li[2]/a")).click();
I tried doing
driver.findElement(By.xpath("//*[#id="3_dropdown_combobox"]/li[2]/a")).getText();
and got the word Active as expected.
Try to see if the link takes you to the correct location