The below are a few usages I encounter often.
XPath element locator
Very common in locating elements. There is a simple XPath tutorial at W3School, though I'm not a big fan of W3School.
public MetaData ClickConfirmButton()
var okButton = new Button("//*[contains(@id,'confirm-edit')]");
A quick syntax I ofetn come across is
This means, to find an element that has "data-test" attribute with the value of "row" and go the the third element within it, and find an element with "note" value, there. (does it make sense?)
wait until a page is loaded
One big change from Selenium RC to Webdriver is waiting for loading. By default, Webdriver doesn't wait for a page or element is fully loaded. But you can use a handy wait command.
new WebDriverWait(_driver, TimeSpan.FromSeconds(10))
.Until(w => w.Url.Contains("workspace"));
Install the latest flash player for firefox
Once I was testing a page that renders a flash content. The page opens without any problem on Chrome, but not on Firefox. Firefox just get frozen, and the automation test fails miserably. Chrome has its own flash player, so it's updated when the browser is updated, but it's not the case for Firefox. If firefox freezes over flash content, install the latest Flash Player. Otherwise, you will be pulling your hair, condemning Firefox harshly...
Testing "Click to download a file" stuff
By default, firefox pops up the download manager when you try to download a file. Also, the download path can be different per machine. You wouldn't want manager pop-up, as you don't like alert dialogue box. You can set a silent file download on firefox profile.
var firefoxProfile = new FirefoxProfile
firefoxProfile.AcceptUntrustedCertificates = true
"application/zip, application/x-zip, application/x-zip-compressed, application/pdf, text/plain, application/octet-stream, application/vnd.ms-excel, application/msword, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation"
to be continued ...