SeleniumHQ/selenium — pull request #196 by sbabcoc (2014-04-08 21:14:56+00:00)
Title: Replace ExpectedCondition with AnticipatedCondition

Description
===========
Replace the ExpectedCondition interface (which is restricted to using WebDriver as its context) to a new AnticipatedCondition interface (which expands versatility by using SearchContext as its context).

Reason
======
With ExpectedCondition, conditions that are satisfied by element search results always apply to the entire page. This doesn't work very well for page components and other contexts that only apply to a portion of the page. The workaround (passing additional sub-context arguments) has two issues. First, this fails to restrict search operations to their stated sub-context. Second, this carries the risk that the specified sub-context will be derived from a foreign driver instance.

Benefits
========
AnticipatedCondition takes a SearchContext as its context, which enables search operations to be restricted to the desired scope without having to pass in extra sub-context arguments. This also significantly reduces the likelihood for mismatched driver/sub-context.

Drawbacks
=========