In Orchard 1.3.10 and Advanced Menu 1.3 using classes "Current" and "Selected" - menu

I'm using Orchard 1.3.10 and Advanced Menu 1.3 i have an issue with the classes assigned (current and selected).
I have a menu item "Teste1" and another menu item "Teste1 Sample".
When i selected the "Teste1 Sample", is inserted the class "current" to this, and insert "current selected" to "Teste1" item.
They are at the same level.
<ul id="menu-20" class="menu menu-main sf-menu sf-js-enabled sf-shadow">
<li><a class="title" href="/">Home</a></li>
<li class="current selected"><a class="title" href="/Orchard1.3.10/teste1">teste1</a></li>
<li><a class="title" href="/Orchard1.3.10/teste2">teste2</a></li>
<li><a class="title" href="/Orchard1.3.10/teste3">teste3</a></li>
<li class="current"><a class="title" href="/Orchard1.3.10/teste1-sample">teste1 sample</a></li>
<li><a class="title" href="/Orchard1.3.10/teste12">Teste12</a></li>
</ul>
Or if i select the "Teste12" is the same issue.
I don't know why this is happening.
Is this a Bug?

Related

Excel VBA using Selenium - click on href link

I want to Click on href "add_record.php" by VBA Excel Selenium.
Inspect of Targeted site:
<li class="active">
<i class="fa fa-dashboard"></i><span>Dashboard</span></li>
<li class=""><i class="fa fa-link"></i> <span>Add New Record</span></li>
<li class=""><i class="fa fa-link"></i> <span>Add Record from SRF Portal</span></li>
<li class=""><i class="fa fa-link"></i> <span>List/Edit/Followup</span></li>
<a href="#">
Just to click this element use css selector. * means finding any text as specified after =.
driver.findElementByCssSelector("a[href*=add_record]").Click

Click open nested unordered HTML list(drop-down menu) using Python and Selenium

I would like to click open navigation bar element ("Residential Detached") shown here:
Here's the HTML behind this element:
<div id="app_banner_menu">
<ul class="AspNet-Menu">
<li><a data-bind="" url="/ParagonLS/Home/Page.mvc" tabDescription="Home" subTabDescription="" subTabMaxAllowed="0" targetEx="" rel="" subTabGroup="false" subTabGroupAdd="false" subTabStartIndex="" subTabGroupClose="false" fullWindow="False" hideAddressBar="False"><span id="home-nav" class="MenuIcons homeButton"></span></a></li>
<li>
<span id="search-nav" class="MenuIcons searchButton"></span>
<div>
<ul>
<li>
Search By Class
<ul>
<li><a data-bind="" url="/ParagonLS/Search/Property.mvc/Index/1" tabDescription="Residential Detached" subTabDescription="Criteria" subTabMaxAllowed="3" targetEx="" rel="" class=" SearchByClass1 " subTabGroup="true" subTabGroupAdd="true" subTabStartIndex="0" subTabGroupClose="true" fullWindow="False" hideAddressBar="False">Residential Detached</a></li>
<li><a data-bind="" url="/ParagonLS/Search/Property.mvc/Index/2" tabDescription="Residential Attached" subTabDescription="Criteria" subTabMaxAllowed="3" targetEx="" rel="" class=" SearchByClass2 " subTabGroup="true" subTabGroupAdd="true" subTabStartIndex="0" subTabGroupClose="true" fullWindow="False" hideAddressBar="False">Residential Attached</a></li>
This is the code I wrote to accomplish the same, but it doesn't work.
resedential_detached_class = browser.find_element_by_xpath("//div[contains(text(),'Residential Detached')]").click()
How can I pick just that element and click open it? It will lead me to a new page.
Have you try this selenium tag:
resedential_detached_class = browser.find_element_by_link_text('Residential Detached').click()

Create a Bootstrap menu with WayFinder

Trying to create a Bootstrap menu with WayFinder. How to finish it?
<ul class="nav navbar-nav">
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu" aria-labelledby="drop1">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu" aria-labelledby="drop2">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li role="separator" class="divider"></li>
<li>Separated link</li>
</ul>
</li>
</ul>
My WayFinder call so far:
[[Wayfinder? &startId=`0` &level=`1`
&hideSubMenus=`TRUE` &includeDocs=`1,2,3,4,5,55,7,8,74`
&outerTpl=`chunk_navigation-menu`]]
And my chunk_navigation-menu looks like this:
<ul class="navbar-nav nav">[+wf.wrapper+]</ul>
First of all, I am assuming you are using MODX Evolution.
The easiest way to do that is using
&outerClass
&parentClass
&innerClass
&parentRowTpl
In your Wayfinder call.
It should look like this:
[[Wayfinder? &startId=`[(site_start)]` &level=`2` &outerClass=`nav navbar-nav` &parentClass=`dropdown` &innerClass=`dropdown-menu` &parentRowTpl=`navbar_parentRowTpl`]]
Note: If you don't use [(site_start)] in your context(s), replace it with your menu's parent resource ID.
Also in this case you would have to create the navbar_parentRowTpl. This chunk should look like this:
<li[+wf.id+][+wf.classes+] class="dropdown" id="menu[+id+]">
<a class="dropdown-toggle" data-toggle="dropdown" data-target="#menu[+id+]" href="[+wf.link+]" title="[+wf.title+]">
[+wf.linktext+]
<b class="caret"></b>
</a>
[+wf.wrapper+]</li>
As it's been a long time I don't work with Evo, if there is some problem with this code let me know and I can help you.
I used this example as reference: https://gist.github.com/mkay/f0afc97ec1536932e0a3
And used this table to convert to the Evo syntax:
https://rtfm.modx.com/revolution/2.x/making-sites-with-modx/tag-syntax

Automate with watir on-screen keypad login

I'm wondering how to automate with watir the clicks on a on-screen keypad. I'm trying to automate the login on this web, but I don't know how to recognize the numbers and click on them:
https://bancaelectronica.evobanco.com/
If you look at the HTML of the keyboard, each key is simply a link:
<div class="virtual_keyboard active">
<ul>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">3</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">7</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">1</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">0</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">4</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">5</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">6</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">2</a></li>
<li><a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">8</a></li>
<li class="correction">
<a id="btCorrect" href="javascript:void(0);" data-target=".activeInput" class="keypad-btn delete-key">Corregir</a>
</li>
<li>
<a data-target=".activeInput" class="keypad-btn value-key" href="javascript:void(0);">9</a>
</li>
</ul>
Cerrar
</div>
You simply need to:
Activate the keyboard by clicking on the password field
Clicking the key links by text (since they are randomly sorted)
An example of typing a password of "123":
browser = Watir::Browser.new :chrome
browser.goto('https://bancaelectronica.evobanco.com/')
# Activate the keyboard
browser.text_field(id: 'cFDMTuKLOsuyeXQ').click
# Wait until the keyboard appears
virtual_keyboard = browser.div(class: 'virtual_keyboard')
virtual_keyboard.wait_until_present
# Enter the password by clicking the number links
virtual_keyboard.link(text: '1').click
virtual_keyboard.link(text: '2').click
virtual_keyboard.link(text: '3').click
The same approach can be taken for other on-screen keyboards. However, the exact elements to interact with will depend on the page's implementation of the keyboard.

Bootstrap Hover Dropdown Plugin not works in durandal view nav.html

I am using hot towel SPA template.
i am trying to use at Bootstrap Hover Dropdown Plugin but hover over drop down effect never triggers.
nav.html contains
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="false">
Account <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a tabindex="-1" href="#">My Account</a></li>
<li class="divider"></li>
<li><a tabindex="-1" href="#">Change Email</a></li>
<li><a tabindex="-1" href="#">Change Password</a></li>
<li class="divider"></li>
<li><a tabindex="-1" href="#">Logout</a></li>
</ul>
Steps to reproduce.
1) create Application using Hot Towel SPA template
2) add bootstrap-hover-dropdown.min.js in vendors bundel
3) replace the nav.html code with the code above.
same nav.html code pasted above applicationHost div does trigers hover drop down effect. But when injected using durandal. it doesn't work.
Here is what you need to do to have the dropdown hover working:
in your nav.html file: remove the last line <script src="../../TemplateFiles/assets/hover-dropdown/bootstrap-hover-dropdown.js"></script>not needed here.
in your shell.js file: add the following function:
function compositionComplete() {
$('[data-hover="dropdown"]').dropdownHover();
}
And also modify your shell var as below:
var shell = {
activate: activate,
compositionComplete: compositionComplete,
router: router
};
That's all!
The trick here: in the compositionComplete function I 'force' the initialisation of the dropdown hover effect. If you take a look in the plugin source file, at the end of the file you have this:
$(document).ready(function() {
// apply dropdownHover to all elements with the data-hover="dropdown" attribute
$('[data-hover="dropdown"]').dropdownHover();
});
In a more 'classic' situation you have nothing to do (except reference the source plugin). The problem with Durandal is that this is not triggered so I do it in the compositionComplete.
Hope I'm clear.

Resources