I can do myForm.getForm().findField('myFld'); to find a field by name. What's the equivalent of finding a button?
Fields exept name can also have ref propety:
name: 'fieldID',
ref: 'your_reference',
this way you do not need to find them - to access this.your_reference
you can do it with button also. Trick is: if button is on toolbar (top or bottom) use ref: '../your_btn_ref' to get 1 level up 9direct will go to toolbar)
Do you mean find? "Find a component under this container at any level by property."
More generally, you can use findBy.
Try this:
getItemByItemId(btnId)
using "ref" doesnt always work, it is abit hit and miss.
I would recommend either giving the button and ID and using Ext.getCmp(buttonid);
or
Search for the button class using Ext.select and select the approriate array key, Ext.select();
Related
I'm currently trying to develop an Eclipse Plugin to support code replacement, like what the default content assist in Eclipse do. What I want to implement is something like "insert argument names automatically on method completion with visualized box around the argument" and I can "use the Tab key to navigate between the inserted names" and "while navigating, list of optional variables for current argument can be displayed and be chosen".
In short, it comes to two questions:
How to add the visualized box around the already existed variable or even Java keywords that need replacement? And at the meanwhile I can use Tab key to switch between these boxes.
How to display a list of candidates to select from when I trigger on the box?
By now I only figure out the extension point : org.eclipse.jdt.ui.javaCompletionProposalComputer may be useful, but I have no idea where to start at? Thanks in advance.
Oh, finally I've solved it myself...
For the 'box', it should be the LinkedModeModel, this class should work with LinkedPositionGroup and LinkedPosition to add mutiple boxes. And we should use LinkedModeUI to set it up.
For the content assistant, there's no need to use the extension point. There is a ProposalPosition class which extends LinkedPosition for you to add your proposals for the 'box' in its constructor. And we can simply use the CompletionProposal to construct a ICompletionProposal array as the argument of ProposalPosition's constructor.
i am not able to discover how to use the alt/combined fragment correctly in starUML,as in there is no way that i am able to provide the condition after the alt fragment appears.can any1 just list down the procedure as to how to do it or a link to some good tutorial.
If you are using StarUML 2 (Beta), you can go through these simple steps:
Add Combined fragment to your sequence diagram:
If you try to add operand(alt partition) through context menu, you'll see that there's no option to add new operand:
3.To achieve this, you can simple copy the already defined operand and paste it under Combined Fragment:
After that, simply add condition clauses in "guard" property of operands and adjust operand heights:
I had just found the steps as following.
Please refer how to set "alt combinedFragment at starUML due to I have no 10 reputation to post image.
1.create a sequence diagram.
2.add a CombinedFragment1 into diagram.
3.change the "seq CombinedFragment1 " to "alt CombinedFragment1 "
4.select the "Interaction Operand"
5.left-click at the "atl CombinedFragment1 ",you will found the one "InteractionOperand1" added into the "alt CombinedFragment1 ".
6.add the 2nd "InteractionOperand", same with step 4,step5, there will a parting line like the following.
7.set the InteractionOperand's Guard data,my is "isInit",you will found it at the alt frame.
8.add the 2nd Guard data,same with the step7.
9.move the diagram to the proper location.
while,I still have something unknown, for example, how to make the frame located at the top front and add a relationship with the "B method".
Wish it helpful to u.
Add an Interaction Operand to a Combined Fragment. When you select the Interaction Operand you should see in the Properties Inspector a 'Guard' field. You can type your condition just there.
Many thanks for your posts.
By the way, I noticed when adding a Combined Fragment from the left Pane,
that the alt keyword could be displayed as shown below,
after selecting the interactionOperator from the right pane,
NB: other useful keywords such as the "loop" one are also available from the above list
When you add a 'Combined Fragment' double click on the name on the diagram
Then you get a small icon with 3 horizontal lines to the left of the name
When you click on that you can get as much interaction operands as you wish
What's the correct XPath syntax to check if an option element is currently selected, or just to get the selected option element from a select element, on an open page with which the user, and JavaScript, may have interacted? Is this even possible with XPath, or does it lack the ability to look at DOM properties?
I can't find any documentation on this, and have (speculatively) tried:
//option[#selected=true]
//option[#selected="selected"]
//option[#selected]
but none of these work; they simply don't match any elements.
(In case it matters, I've tried this both using the $x function in the Chrome developer console, and using the find_elements_by_xpath method in Selenium for Python.)
Short answer: it's not possible.
Longer answer: XPath can look at HTML attributes, but it can't look at DOM properties. Selecting an <option> element in a <select> changes the selected property of the <option> to true, and also changes the value property of its parent <select> element, but it doesn't affect the attributes of either, so it is invisible to XPath.
To find <option> elements that have the selected attribute set, which is often how a page author might determine which option is initially selected, you can use //option[#selected]. But this does not find the currently selected <option>; changes that the user makes to the selection are invisible to XPath. There's no guarantee it will even find the initially selected option, since it's possible that the page author didn't put the selected attribute on any elements and either let the browser select the first option by default or had some JavaScript select the initial option via the selected property.
The multiple other answers here claiming that a selector like //option[#selected] can detect selection changes made by the user after the page loads are simply completely wrong.
Of course, if you're able to use CSS selectors instead of XPath selectors, then option:checked will do the job.
The problem could be the " (double quotes).
//select/option[#selected='selected'] - Will match the selected option, i am using this successfully.
//select/option[#selected='selected' and #value='specific value'] - Will only match the selected option if it has a 'specific value', i'm also using this.
If you are still having trouble, it could be an entirely different problem, perhaps there is no option node. I hope this helps.
I think we can use a knowledge from #Mark's answer and account that. Let's just find a node which HAS desired attribute:
tree.xpath('//select/option[#selected]/text()')[0].strip()
I tried "//option[#selected=''] and it has worked for me.
it is able to highlight the selected option within Page objects model.
I would try //option[#selected='true']
i.e. driver.findElements(By.xpath("//option[#selected='true']")).getText();
I have one text box in C# window application.And i wants to set a initial value of this text box is zero.
so i use conversion.val(textbo1.text) method.
But it gives a error in name space.
I use Using Microsoft.visulbasic; name space but it is not working.
So which name space i use for conversion.val().
Please help me.
Thank you.
The namespace you are adding is correct.
Refer: http://msdn.microsoft.com/en-us/library/9da280t0.aspx
Only adding namespace might not work, you will have to manually add Reference to Microsoft.VisualBasic.dll.
You can add the reference as follows:
- Goto the Solution Explorer panel.
- Right click on References > Add Reference.
- Select the tab ".Net"
- Select Component "Microsoft.VisualBasic"
- Click OK.
Now you can use the Conversion class.
Note: You can find Solution Explorer in the View menu.
Good luck!
My problem seemed easy at first but i got stuck.
I have some containers (divs) in my page with some custom attributes.
<div class="myclass" myattr1="blah" myattr2="text1-text2-text3-text4-"></div>
myattr1 and myattr2 are defined by me.
All divs are visible on page load.
Now, depending on user selection from a list, i want to show only the divs with myattrib1="blah" and hide the rest.
I tried the following code, with no success at all
$('#mySelectID').change(function()
{
var startName = $(this).val();
$(".myclass").not('[myattrib1!="+startName+"]').toggle();
});
The same approach will be used to filter results by attrib2, but there i will use myattrib2|="+startName+" ( i think this is correct - thats why i have the extra - on the end of myattr2="text1-text2-text3-text4-").
Can anyone advice me on how to properly achieve this kind of filtering?
thank you!
You are close, but as you can see form the syntax highlighting, your are not performing string concatenation. +startName+ will be taken literally. Fix the quotes and your fine:
.not('[myattrib1!="' + startName + '"]')
Note that you should be using data-* attributes instead of custom ones.