More detail on my comment above. I do use the ContextClick but because of the new window I have to up popupHandle to deal with the results of the right click:
// Get the existing handles
IList<string> existingHandles = this.driver.WindowHandles;
// This is an internal class that uses Context Click to perform the Right Click
Actions clicker = new Actions(driver);
clicker.ContextClick(testUserAccount).Perform();
// Now select the item in the Menu that displays all info for the User
IWebElement showUserInfo = driver.FindElement(By.Id("menu_ID"));
// The rest of this would be for the right click options
showUserInfo.Click();
// Check for the launched window and save the new handle
string popupHandle = myConfig.findNewHandle(existingHandles, driver);
// Once the Window opens set focus on the order Window
driver.SwitchTo().Window(popupHandle);
Where findNewHandle is a separate function:
public string findNewHandle(IList<string> existingHandles, IWebDriver driver)
{
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
// Check for the launched window and save the new handle
string f = wait.Until<string>((d) =>
{
d = driver;
string foundHandle = null;
IList<string> differentHandles = getDifference(existingHandles, d.WindowHandles);
if (differentHandles.Count > 0)
{
foundHandle = differentHandles[0];
}
return foundHandle;
});
return f;
}
For me, I couldn't do anything with the right click context until I was able to find and make active the window the right click brought up.