How to wait for a frame to load before locating an element?
There are a couple of things you need to consider :
The line of code to switch to the frame looks perfect which doesn't throws any error :
var wait = new WebDriverWait(driver, 15);
wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(By.Id("frameA"));
In the next line you have tried the ExpectedConditions method ElementExists. As per the API Docs ElementExists
Method is defined as :
An expectation for checking that an element is present on the DOM of a page. This does not necessarily mean that the element is visible.
Selenium can't interact with elements until the element is visible. Hence you need to use the method ElementIsVisible
as follows :
var wait2 = new WebDriverWait(driver, 15);
wait2.Until(ExpectedConditions.ElementIsVisible(By.Id("elementA")));
Here you can find a detailed discussion on Ways to deal with #document under iframe
You can wait for the frame itself to be clickable:
wait2.Until(ExpectedConditions.ElementExists(By.Id("YOURFRAMEID")));