I have a WebDriver code and need to switch between two frames. Can someone help me here?

I have a WebDriver code and need to switch between two frames. Can someone help me here?

Hi Alex Walker,

For switching between frames, use driver.switchTo().frame(). First locate the frame id and define it in a WebElement. Ex:-

WebElement fr = driver.findElementById("id");

Then switch to this frame using this code:-

driver.switchTo().frame("Frame_ID");

This is how it should fially look like:

WebElement fr = driver.findElementById("theIframe");
driver.switchTo().frame(fr);

Then to move to default frame, use:-

driver.switchTo().defaultContent();