I am getting a web element with the following code.
WebElement textbox = driver.findElement(By.xpath("//input[substring(@name, string-length(@name) - string-length('_connectionName') +1 ) = '_connectionName']"));
This works great and gets the item I needed. I enter a name into it check that the site gives us a specific error and then try to clear it. In order to check that we get that error I have to switch frames.
driver.switchTo().frame("modalIframeId");
I then switch back to the main frame like so
driver.switchTo().frame("Content");
I can close the error dialog that comes up. The text of the error is in a different frame but the X button is in the main frame that the text box is in. After switching back and closing the text box I can't locate the text box using the same code as above. It says it can't find it I need to clear the text box and try a different error. I have am pretty new to selenium and have looked around but can't find anything similar. I had a co worker who has more experience look at it as well and they aren't sure either.
Any help would be greatly appreciated.