Up to version 1.0, it was straightforward to add a dropdown inside another dropdown. It was just adding the < a> trigger < /a> inside the < li> tag < /li>.
Now, is that right we cannot have submenu or sub-dropdown in version 1.0?
I have tried for hours if not days at this point.
Related
I have page for country selection as list box of SelectOneMenu of primefaces component. This page has other list items of same time.
Used the dropdown with JDropdown
#JDropdown(root = ".ui-selectonemenu", expand = ".ui-selectonemenu-trigger", list = "option",
value = ".ui-selectonemenu-label")
Dropdown country;
//
county.select("Canada");
when executed it finds more than one and unable to select
Question - I don't see and id for the JDropdown annotation, so how do we get this working?
Appreciated your help.
im trying to find an element with dinamic values , for example <span class="ms-Button-label label-175" id="id__177">Save</span> in inspect element, the id and class values tend to change for every refresh, how can i in this case find the element in selenium? i tried troguht xpath but seems doesnt work because can not find the path, i was thinking to find "Save" world torught always find by xpath but actually i dont know if im doing well : driver.find_element_by_xpath(//span(#.... but then? how can insert element if it changes everytime? thanks!
Something like this may work:
driver.find_element_by_xpath('//span[text()="Save"]')
But this will fail, if there is more than one button with text "Save" on the page.
In that case you may try to find some specific outer element (div, form, etc.) which does not change and contains the button. Then find the button inside of it.
With few requests with driver:
specific_div = driver.find_element_by_id("my_specific_div")
button = specific_div.find_element_by_tag_name("span") # e.g. there is only one span in that div
Or with more specific xpath:
button = driver.find_element_by_xpath('//div[#class="some-specific-class"]/span[text()="Save"]')
If needed, search for more nested elements before the button, so you can get more narrow search field.
More examples in the docs.
I got a requirement to do a slider in PEGA.
The issue is that I do not manage to get the field/property refreshed with the slider value. I need to use this property in a declare expression and in conditional visibility (layout).
I am looking for something like the autocomplete where the value is refresh without submitting.
Any idear will be welcome.
THX.
Ok, I have solved the issue. In order to actualise the property .Amount outside the layout, I needed to configure an action on the first layout. The one holding the slider. In this layout -> in actions : add an event: Change and Add an Action : Refresh-This section / Target Section.
The value is then dynamicly refreshed in the clipboard too.
PS : in order to have different step value inside the same slider (ex: from 0 to 10 step = 1, form 10 to 30 step = 3 ... ) just use a property in the Slider Parameters 'step' of the slider and link this property to a declare expression. Within the declare expression you can configure as much step as you want.
I am trying to iterate a table to get the results. The structure of the table looks as mentioned in the picture
When I open the page, there is only one with role="presentation" and I am able to retrieve the data using the below css locator.
driver.findElement(By.cssSelector("div[id^=dojox_grid__View_] div.dojoxGridContent div.dojoxGridRow:nth-child(1) tbody tr:nth-child(1) td:nth-child(6)")).getText();
When I scroll the page manually another tag is created dynamically with role="presentation" and has many rows(div.dojoxGridRow). I want to iterate these rows too.
Selenium is able to go only to first level (first ) and get the details. I am not sure how to reach the second level
I'm not sure about which element you're trying to access.
But you can access to all div with 'presentation' role (return a list):
driver.findElements(By.cssSelector("div[role='presentation']"));
If you're trying to access to each row under div with role presentation:
driver.findElements(By.cssSelector(".dojoxGridRow"));
If you want to get rows child of div with role 'presentation':
List<WebElement> presentations = driver.findElements(By.cssSelector("div[role='presentation']"));
for (WebElement presentation : presentations) {
List<WebElement> rows = presentation.findElements(By.cssSelector(".dojoxGridRow"));
// DO SOMETHING...
}
Hope that helps.
I have two divs nested under a parent div and I want all these to be source as well as targets for dojo.dnd.
I want to be able to add nodes to the div over which the content was dropped and also allow the user to move this in between the 3 divs.
Something like this -
http://www.upscale.utoronto.ca/test/dojo/tests/dnd/test_nested_drop_targets.html
This is I gues implemented in older version of Dojo and doesn' seem to work with 1.4
Is the support for nested targets removed? Is there any way to achieve this?
Nested sources/targets are not supported currently. In most cases you can work around this restriction by using independent sources/targets, yet positioning them as you wish with CSS.
I used a workaround for this case. I create another DIV element which positioned at the same place of the nested target with same width and height but with higher z-Index value. Then the new DIV element covers the nested target. When user is trying to drop on the nested target, he actually drops to the above new DIV element. As long as the new DIV element is not nested in the parent drop target, Dojo's dnd operation works well. I usually put the new DIV element as a child of the body element.
What you need to do is to create the new DIV in onDndStart and destroy it in onDndCancel, then everything should work well.
Dojo version 1.10 still does not support nested Dnd.
CSS positioning and overlay div's didn't work for me. But I noticed that dragging an element out of a dndContainer into a parent dndContainer doesn't trigger onMouseOverEvent for the parent.
In case someone is still using dojo and has the same problem, here is my approach to solve this:
Declare your own dndSource e.g. nestedDndSource.js
define([
"dojo/_base/declare",
"dojo/dnd/Source",
"dojo/dnd/Manager"
], function(declare,dndSource, Manager){
var Source = declare("dojo.dnd.Source", dndSource, {
parentSource: null,
onOutEvent: function(){
if(this.parentSource != undefined)
Manager.manager().overSource(this.parentSource)
Source.superclass.onOutEvent.call(this);
}
});
return Source;
})
Use that nestedDndSource for the children instead of dojos and make sure to provide the dndSource of the parent as parentSource-Parameter:
var parentDndSource = new dojoDndSource(parentNode, {..});
var childDnDSource = new nestedDndSource(childNode,{
parentSource: parentDndSource,
onDropExternal: ...
});
Working example: https://jsfiddle.net/teano87/s4pe2jjz/1/