How can I make a dojox.form.Raiting readOnly - dojo

I have a requirement where users need to rate a response; for this I'm trying dojox.form.Rating widget.
This works fine so far, but, I need to provide a readonly average rating as well.
I have tried disabled=true or disabled=disabled according to http://dojotoolkit.org/api/, but, it is not working.
I also tried wrapping this div within a xp:panel with ReadOnly property and still I'm able to select a value from it.
<div id="rateControl" dojoType="dojox.form.Rating" numStars="5"
disabled="true" value="2" class="pull-right">
</div>

As Michael commented, it doesn't respect "disabled" attribute and patched Rating widget does not exist in the dojo library shipped by Domino server.
In my xInvolve project, I have used the dojo Rating widget. For read-only, I have just implemented a repeat control within a div. You can see the code in the XSnippets project.
<xp:div id="ratingReadonly"
styleClass="ratingStarWrapper">
<xp:this.rendered><![CDATA[#{javascript:(! invTools.isRatingEnabled(compositeData))}]]></xp:this.rendered>
<xp:repeat id="repeat1" first="0"
indexVar="starIndex" rows="100" var="starType"
style="display:inline">
<xp:this.value><![CDATA[#{javascript:invTools.getRepeatArray(compositeData)}]]></xp:this.value>
<xp:image id="image2">
<xp:this.url><![CDATA[#{javascript:"/.ibmxspres/dojoroot/dojox/form/resources/images/rating_"+starType+".gif"}]]></xp:this.url>
</xp:image>
</xp:repeat>
</xp:div><!-- end-ratingReadonly -->
Here, invTools.getRepeatArray(compositeData) contains the number of 'full' and 'empty' stars. e.g. for 3/5 stars, it is ['full', 'full', 'full', 'empty', 'empty']

Hi there is a bug with the dojox.form.Raiting, see the bugs.dojo:
Instead of the patch you could use a Workaround you could use a overlay div wich is rendered when the control should be readonly:
<xp:panel id="container">
<xp:panel id="overlay" style="width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 10;"></xp:panel>
<div
id="rateControl"
dojoType="dojox.form.Rating"
numStars="5"
value="2"
class="pull-right">
</div>
</xp:panel>

Related

vba selenium find element in dialog role

<div id="j_idt249" class="ui-confirm-dialog ui-dialog ui-widget ui-widget-content ui-corner-all ui-shadow ui-hidden-container ui-dialog-rtl" role="dialog" aria-labelledby="j_idt249_title" aria-hidden="false" aria-live="polite" style="width: auto; height: auto; left: 385px; top: 265px; z-index: 1022; display: block;">
<button id="j_idt250" name="j_idt250" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left ui-confirmdialog-yes" type="button"><span class="ui-button-icon-left ui-icon ui-c ui-icon-check"></span><span class="ui-button-text ui-c">Save</span>
Button is inside of div.
How can i click the button
bot.FindElementByName("j_idt250").Click
its not work.
its something like dialog alert.i atached that pic.Pic of site
The name attribute looks dynamic and will not be a reliable web element locator.
Instead it looks like a save button.
//button[text()='Save']
Code :
bot.FindElementByXpath("//button[contains(text(),'Save')]").Click
Did you try switching to Alert like this
driver.SwitchToAlert.Accept
If the 'id' is available in an element, always use that. If not, go for the other locating strategies. In your case, the Id is present. So, use it when locating.
bot.FindElementByName("j_idt250").Click
If this won't work, then check the DOM and check whether your element is within an iFrame or not. If there is an iFrame, you need to switch to that iFrame first and then click on the button.

CSS for intra-page anchor glyph on hover

I'm trying to duplicate the effect I see in the Bootstrap docs and elsewhere:
When you hover over an h1/h2/h3 etc, a glyph appears that enables you to copy/paste a url that includes a fragment identifier eg http://foo.com/woof.html#page_fragment
Picture:
The "chain" icon only shows on the left on hover
Question: is this affect available from within the Bootstrap library or elsewhere?
And what is the name of this type of UX?
Like you noticed bootstrap has no native way to do that : however, with little css and html it will work perfectly :
Working fiddle : https://jsfiddle.net/5of43a4r/
CSS :
h1:hover a.anchorjs-link {
display: block !important;
}
HTML :
<h1>
<a class="anchorjs-link" href="#page_fragment" style="position: absolute; margin-left: -1em; padding-right: 0.5em;display: none">
<span class="glyphicon glyphicon-link" aria-hidden="true"></span> </a>
H1 TEXT
</h1>
Starting with the "anchorJS" clue from Sébastien's answer, I found Bootstrap Anchor, "The missing Bootstrap plugin for anchor support."

Bootstrap: How to control the height of each grid row?

I am using Bootstrap's grid to align an input, a button and an alert message.
However, I found the height of alert message is much higher than that of button and input.
Is there a way to make the height of all elements in grid consistent?
Here is example and code:
https://jsfiddle.net/rktg0L2w/
<div class="container-fluid">
<div class="row" >
<div class="col-xs-3 col-xs-offset-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Search</button>
</span>
</div>
</div>
<div class="col-xs-3">
<div class="alert alert-success"> Result: </div>
</div>
</div>
</div>
Thanks
Derek
Alert div isn't made to place inside your views. It has it's own padding and margin. It is usually put at the top of page.
However if you want to put it inside your view. You could either make it small by removing padding or make your view vertical align.
I made both alternatives in this https://jsfiddle.net/rktg0L2w/1/
1) For small alter div that matches your input change padding:
.alert-small{
padding: 7px;
}
2) In case you want to make both input and alter vertical align:
Place vcenter class on your row div and alert-large on your alter div.
.vcenter {
display: flex;
align-items: center;
}
.alert-large{
margin-bottom: 0px;
}
Bootstrap has its own standard, however you can change the code by edit the raw bootstrap css or override the bootstrap css code. For example :
padding is the problem in your case, click here for 1st picture
hola, click here for 2nd picture
However, you can make it specific by adding new class or with your superpower and your handsomeness tho
t(.__.t) my life

How to use CSS locator with tag + class name + inner html text to identify a button in a span

I am using selenium FirefoxDriver to automate a test case (I am new at this)
I need a way to locate a Button (which I think is implemented as a div/span)
This xpath locator works when I try that in Selenium IDE //span[contains(text(), 'Login')]
Also I can use this CSS locator using the span tag and the classname css=span.x-btn-button
What I need is a way to use CSS locator with tag + class name + inner html text. (This will help me in handelling some of the other UI element in my application)
HTML is as below
<div id="toolbar-1035" class="x-toolbar x-docked x-toolbar-footer x-docked-bottom x-toolbar-docked-bottom x-toolbar-footer-docked-bottom x-box-layout-ct" style="right: auto; left: 0px; top: 141px; width: 223px;">
<div role="presentation" class="x-box-inner " id="toolbar-1035-innerCt" style="width: 217px; height: 22px;">
<div role="presentation" class="x-box-target" id="toolbar-1035-targetEl" style="width: 217px;">
<a id="button-1036" unselectable="on" hidefocus="on" class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-small x-noicon x-btn-noicon x-btn-default-small-noicon" style="right: auto; top: 0px; margin: 0px; left: 0px; width: 75px;" tabindex="0">
<span unselectable="on" class="x-btn-wrap" role="presentation" id="button-1036-btnWrap">
<span role="presentation" class="x-btn-button" id="button-1036-btnEl" style="background-color: transparent;">
<span unselectable="on" class="x-btn-inner x-btn-inner-center" id="button-1036-btnInnerEl" style="background-color: transparent;">Login</span>
<span style="" unselectable="on" class="x-btn-icon-el " id="button-1036-btnIconEl" role="presentation"></span>
</span>
</span>
</a>
</div>
</div>
</div>
This post has some real good methods to use xpath/css for element identification!
Is it possible to get next sibling using cssContainingText in Protractor
Function cssContainingText is however specific to Protractor.
#Css
findElement(By.cssSelector("span.x-btn-button:contains('Login'));
Keep in mind that this pseudo-class in CSS is not supported by every browser, specifically this is not supported in PhantomJS (There may be other browsers this does not work in, but that is the one I remember).
From Here, about 75% of the way down the page.
Edit:
After looking at this a little more, it seems the pseudo-selector of ":contains('')" is no longer within the CSS3 spec. Reference
If your web application uses JQuery, you can retrieve the element that way with a similar selector, otherwise, you will have to load JQuery into the page and then use it, but that really wouldn't be using CSS, but rather javascript selector functions within JQuery that use CSS syntax.
Conclusion:
Currently, what you are asking is (officially) not supported by CSS.

How to click <input type="text" > in selenium WebDriver

I am having below mentioned code in which i want to click on a <input> type.
<div class="gwt-TabBarItem" tabindex="0" role="tab">
<div class="gwt-TabBarItem" tabindex="0" role="tab">
<input type="text" tabindex="-1" style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="gwt-Label" style="white-space: nowrap;">Explore by Research Topic </div>
</div>
I want to click on <input type="text" ....>
I have tried all possible things like Click, WebElement Click, Java Script Click,sendkeys etc.
But it is not working for me.
Do anyone have any solution for this.
Thanks in Advance
If you're using the Selenium IDE, then use click command, with target as "css=input[type=text]". Should work. Selenium allows use of CSS selectors for locating elements. Examples of possible CSS selectors you can use are given here:
http://www.w3schools.com/cssref/css_selectors.asp
Hope this helps.
Try with the following Xpath:
//div[contains(text(), 'Explore by Research Topic')]//preceding-sibling::input
It worked for me.
Regarding code you provided the input field is hidden so you can't click it.
If this is not a temporary state and you still need to interact with it, try to change element opacity to displayed first - via JavaScript / jQuery.