Comments (6)
Same goes for Menu/menuitems I guess. Will have a look at this.
from flaui.
How about a virtual FindByText method on the combobox?
The default implementation would loop thru the Items and select their .Name and returns the first which matches the text or null otherwise.
So it would look like:
myCombo.FindByText("Some Value")?.Select();
from flaui.
Pretty much like this:
/// <summary>
/// Search the first item which matches the given text.
/// </summary>
/// <param name="textToFind">The text to search for.</param>
/// <returns>The first found item or null if no item matches.</returns>
public virtual ComboBoxItem FindByText(string textToFind)
{
var items = Items;
return items.FirstOrDefault(item => item.Text.Equals(textToFind));
}
Would that be enough?
from flaui.
Sure, functionally this would work, but now the API for selecting an item is different depending on whether you want to select by id or by text.
myCombo.Items[int index].Select();
myCombo.FindByText("Some Value")?.Select();
while I would find the following more logical (but it is a breaking API change...):
myCombo.Items.Select(int index);
myCombo.Items.Select(string textToFind);
from flaui.
Check my commit above ;) It's exactly like this now. Except that it is myCombo.Select(int index or string textToFind) and not myCombo.Items.Select(...)
from flaui.
Great, that's even better IMO! (and nicely matches the White API ;) )
from flaui.
Related Issues (20)
- Menu item can only be found after getting `GetMainWindow` again HOT 2
- Cannot find some existing elements by FindAllDescendants() HOT 3
- Create a new AutomationElement based on UserControl HOT 1
- Unable to get the text for ComboBoxItem HOT 2
- Could not find process with id HOT 3
- I cannot get the combo box list. HOT 2
- Process ID returned by FlaUI.Core.Application is different from windows process ID HOT 2
- When Flaui will support .net core 8.0 HOT 2
- Instance of an object from System.Windows.Input halves the point passed to Mouse.Click HOT 1
- How to find and write this textbox
- FindAllDescendants does not return all descendants HOT 8
- how to load a windows store app photo app
- Application.GetAllTopLevelWindows() is slow HOT 9
- Jenkins machines cannot capture elements with ControlType: UIA_WindowControlTypeId (0xC370) and LocalizedControlType: "dialog" HOT 1
- Taking text pattern information from grid header and cells
- The latest release (4.0.0) depends on deprecated (and vulnerable) libraries
- Enhance GetRowsByValue Method to Support Partial Matching and Case Sensitivity
- FindFirstDescendant error HOT 1
- who can help me? HOT 1
- XPath query does not return root.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flaui.