- Create a folder named Models, then create a class definition like this:
class IWebElementList : ObservableCollection<IWebElement> {}
The ObservableCollection is a part of this library:
using System.Collections.Generic;
We are modeling a collection Selenium IWebElements. That class is defined here:
using OpenQA.Selenium;
- Create a new UserControl and name it ElementGrid.
- Click on View/Other Window/Data Sources
Once imported...
You should be able to select the presentation layout, note it defaults to a datagrid
Uncomment the code parts, and notice there are two areas requiring our attention.
"your data" will be an instance of an ObservableCollection . This will come directly from Selenium.
"Resource Key..." will be found in the User Control pages, Resources area as shown here.
Congratulations, you've just created a GUI interface to Selenium in literally 2 minutes.
This same technique works for any model. In a future article we'll discuss the benefits of the CollectionViewSource.
JWP2021 Instant DataGrid
Top comments (0)