In reply to your first question:
If you are using Selenium/Webdriver you can use the WebDriverWait class (see this: How do you wait for jQuery Ajax callslink to complete in Selenium 2so answer) or you could use driver.FindElements(..)
as it does not throw if no elements are found. You can then use some linq magic to get the first match. So it would look something like this: driver.FindElements(..).FirstOrDefault()
.