Thursday, August 2, 2007

New features in RC0

We've been heads down trying to get V1.0 out of the door. We apologize for not being active on the blog...

We've had great feedback from customers regarding issues they want to see fixed or improvements in WebAii. We've been trying to address these issues as they come along and we will be updating the RC builds more frequently to get customers these fixes if any are blocking them.

With RC0, we introduced few additional features that customers have been asking for. Specifically: HtmlControl suite that abstracts out actions/verifications. So you can do: button.Click() instead of Actions.Click(Element). or Assert.IsTrue(textBox.Text.Equals("foo") instead of Element.GetAttribute("value").Equals(""). In addition to many new features to make the abstraction even more powerful.

Here is a taste of what you can do with the HtmlControls suite in RC0:

Finding Controls


// Find an HTML Button with id htmlbutton and click it


Find.ById<HtmlButton>("htmlbutton").Click();



// Find the first table on the page.


HtmlTable outertable = Find.ByTagIndex<HtmlTable>("table", 0);


Assert.IsTrue(outertable.Rows.Count == 3);




A Find object scoped for searching only within the container html control.


// Find the first table inside the outer table


//


// Note: HtmlContainerControls have a Find object


// associated with them that scopes all the Find.Byxx searches


// to elements contained within them only.


// So even if you have multiple controls with similar contained


// elements, this will help avoid any conflicts.


// Also, note how we are referencing the innertable using index 0


// since it is the first table inside our outer table.


//


HtmlTable innerTable = outertable.Find.ByTagIndex<HtmlTable>("table", 0);


HtmlTableCell cell = innerTable.Find.TableCell("TD21");


Assert.IsTrue(cell.Text.Equals("TD21"));




Navigate up the control tree


// Find the table that contains this cell.


// Navigate up until you find the first html table.


HtmlTable table = cell.Parent<HtmlTable>();




Find all controls that meet certain criteria. Just like the Find.AllByxx


// Find all HtmlInputText control with src containing partial value foo


IList<HtmlInputText> txtCtrls = Find.AllByAttributes<HtmlInputText>("src=~foo");




Automate actions on the control


//


// CLICKING


//


// Click using the DOM


Find.ById<HtmlInputButton>("button1").Click();


//


// Click using a pure desktop mouse click


Find.ById<HtmlInputButton>("button1").MouseClick();


//


// Check a checkbox and invoke the onclick event.


HtmlInputCheckBox ck = Find.ById<HtmlInputCheckBox>("checkbox1");


ck.Check(true, true);


//


// Query the checked state


Assert.IsTrue(ck.Checked);


//


// Invoke event on the control.


HtmlAnchor link = Find.ByAttributes<HtmlAnchor>("href=~google");


// Invoke any events on the control


link.InvokeEvent(ScriptEventType.OnFocus);


//


// You can capture any element on the page using the .Capture()


// Will be stored to the Log.LogLocation


Find.ById<HtmlInputImage>("image1").Capture("myfile");


//


// SELECTING


//


HtmlSelect select = Find.ById<HtmlSelect>("select1");


Assert.IsTrue(select.SelectedOption.Value.Equals("Option1Text"));


Assert.IsTrue(select.SelectedOption.Text.Equals("Option1"));


//


//


// and much more...




Get any control property directly from the DOM including Read-Only properties. You can also set any property


// Get whether a checkbox is enabled or disabled.


HtmlInputCheckBox cks = Find.ById<HtmlInputCheckBox>("checkbox1");


bool disabled = cks.GetValue<bool>("disabled");



// Disable it


cks.SetValue<bool>("disabled", true);



Assert.IsTrue(cks.GetValue<bool>("disabled"));




Hope you enjoy using these new features. Send us some feedback on what else you would like to see in the framework that would make your testing more productive..

BTW - A recorder is in the works...

2 comments:

Anonymous said...

Can't download RC0 and am still using B2 :(

It would be great to test the new features...

Thanks for the great tool!

Anonymous said...

Hogan scarpe is synonymous with basketball and players have been pretty comfortable wearing them. Teenagers interested in skateboard have tried wearing Hogan scarpe donna and are in love with these shoes, thanks to the ease and comfort it lends. This popularity has encouraged hogan donna to introduce newer styles and designs, so that Hogan scarpe uomo regular base of clients and customers are happy.