In my previous blog post I explained how you can use the new Page class in your code. Having this class available did spark some new ideas in the community. And again Jeff Brown offered some hours of sleep to make your page classes even more terse by introducing the FindByAttribute. Another new attribute is the DescriptionAttribute.
FindByAttribute
The FindByAttribute can be used on Fields and Properties and gives you a declarative style of expressing how an element should be found. In the following example the GoogleSearchPage is revamped and makes use of the new FindByAttribute.
Note that I only changed the GoogleSearchPage class and didn't have to change the test. And yes indeed, no actual c# code is needed and it almost reads like a real sentence. If only we could get ride of the syntax overhead like the [()] public:
FindBy Name q TextField SearchCriteria
2 reacties:
The new syntax is nice. Is it possible to use it for nested searches, e.g. "the first Link named "back" in Table with id "menu"?
Dieter
Checkout my jquery style CSS selectors for watin. It may be very similar to the jQuery constraint you are talking about. http://bit.ly/7kiQdL
Een reactie posten