With Visual Studio 2012 I created a JavaScript Blank App, added a global variable in js/default.js:
var mylabel = "my label";
and I called
WinJS.Binding.processAll();
at the end of app.onactivated.
Then I added two AppBarCommands in default.html:
<button data-win-control="WinJS.UI.AppBarCommand"
data-win-bind="label: mylabel">
</button>
<button data-win-control="WinJS.UI.AppBarCommand"
data-win-bind="innerText: mylabel">
</button>
The first binding does nothing, the second one shows the text "my label" instead of the button. How can I databind the button label ?
You need to bind the label property of the app bar command control instance. This can be done with:
<button data-win-control="WinJS.UI.AppBarCommand"
data-win-bind="winControl.label: mylabel">
</button>
Found in the answer of another question that I can use:
data-win-options="{label: mylabel}"
But it doesn't work if I have a ListView with an itemtemplate that contains an AppBarCommand, and I want to databind to a List.
Related
URL-
<input type="image" src="/live_market/resources/images/gobtn.gif" alt="btn" onclick="goBtnClick('stock');" style="cursor: pointer">
I am trying to click the go button.
IE.document.getElementById("underlyStock").Value = "ACC"
IE.document.all.Iteam(stock).FireEvent ("onclick") ' not working
IE.document.querySelector("goBtnClick('stock')").Click 'not working
The selector you want is probably:
input[type=image][onclick]
You can invoke the onclick function directly:
document.querySelector("input[type=image][onclick]").onclick()
How add tooltip for disabled dropdown button. I use reactstrap.
Disable the pointerEvents on the disabled button, so you're actually hovering on span instead of buttons:
<span id="foo">
<Button disabled style={{ pointerEvents: 'none' }}>nope!</Button>
</span>
<Tooltip target="foo" ...etc>Button is disabled</Tooltip>
Not sure if drop down buttons behave the same as regular buttons, bur for a regular button, you can wrap the button in a div, and set the tooltip to target the div.
<div id='foo'>
<Button disabled>nope!</Button>
</div>
<Tooltip target='foo' ...etc>Button is disabled</Tooltip>
I am working on automating a task. I want to click a Save button on a web form using VBA, but it's not working:
<input name="save" title="Save" class="btn" type="submit" value=" Save ">
<input name="save" tabindex="79" title="Save" class="btn" type="submit" value=" Save ">
I've tried ie.Document.all("save").Click, but it doesn't seem to work. What method do I need to click the button?
You can try going through all your "btn" class collection, and click the one with your save value:
Dim btnClassColl As Object, btn As Object
Set btnClassColl = ie.document.getElementsByClassName("btn")
For Each btn In btnClassColl
If btn.Value Like "*save*" Then
btn.Click
Exit For
End If
Next
Also: make sure that your web page has FULLY loaded before trying to automate anything.
Edit
In response to the comment:
This code is neither giving error nor its clicking on btn. Can this be because there are two buttons on web page with same name and function?
An alternative solution would be that if you know the index number of the collection item, you can simply use that index number and not loop at all. In this case, your index # is 1 (remember: Base 0).
Try this alternative:
Dim btn As Object
ie.document.getElementsByName("save")(1) '1 actually means #2 in index
I'm using Soda (node.js) w/ Selenium RC to automate browser testing.
If I have an AngularJS directive -> say a button that has a spinner -> and it appears multiple times on a page, how can I make sure to click on that particular button...when it has no DOM ID or unique class? In my case, "Login" and "Some Other Button" are dynamic and would be unique for all buttons in the ng-view.
<my-requesting-button text="Login" class="ng-isolate-scope ng-scope">
<button type="submit" class="btn btn-large">
<img src="/img/progress.gif" style="display: none;">
<span>Login</span>
</button>
</requesting-button>
<my-requesting-button text="Some Other Button" class="ng-isolate-scope ng-scope">
<button type="submit" class="btn btn-large">
<img src="/img/progress.gif" style="display: none;">
<span>Some Other Button</span>
</button>
</requesting-button>
Soda (basically directly from the example):
browser
.chain
.session()
.open('/')
.clickAndWait('...LOGIN BUTTON REF?')
.waitForPageToLoad(2 * 1000)
.clickAndWait('...SOMEOTHER BUTTON REF?')
.waitForPageToLoad(2 * 1000)
You can give it a unique ID/class name. If you know this element will only ever be on the page once, you can give it a unique ID. If not, you can give it a class name so that Selenium can find just the first one, or the one near your login form.
To do this, you can either pass the text value (e.g. "Login") to your button so that it has it:
<button class="{{text}}Button">
or you can tell Selenium to find the button that comes right after the element whose text attribute is "Login".
I have a page where many edit buttons are there. And each button have same id i.e enable_edit_content . How to click a specific button .
This is the code where i have to click
<div class="sub-controls" id="motion_eligibility_entry-subcontrols">
<button class="btnedit" **id="enable_edit_content"** name="button" type="button"></button>
<input class="btnsave submit_form" id="save_motions_eligibility_entry" name="commit"
type="submit" value="" disabled="disabled">
<button class="btnkill" id="cancel_content" name="button" type="button"
disabled="disabled"></button>
</div>
Any help will be highly appreciated.
I have tried but could not get my results :-
1) page.all(:css, '#enable_edit_content').each_with_index do |el, i|
i += 1
if i == 3
el.click
end
end
2)find(:xpath, "//div[#id='motion_eligibility_entry-subcontrols']/button[1]").click
you can also scope down your css selector with a within block.
within('.sub-controls) do
page.find('#enable_edit_content).click
end
Because of this very issue, I'd highly recommend shying away from xpath and use css selectors instead!
Hope this helps.