Skip to content

Frames

In some cases you can't access an element because it is inside an iframe, the element is not visible when you search outside an iframe, you have to go into the iframe and search inside.

Entering the <iframe>

To enter the iframe, use the method below.

# Getting the element.
iframe = bot.find_element(selector='iframe', by=By.ID)

# Switch to iframe.
bot.enter_iframe(iframe)
// Getting the element
WebElement iframe = findElement(By.id("iframe"));

// Switch to iframe
enterIframe(iframe);

Exiting the <iframe>

If you want to exit an iframe, use the method below.

bot.leave_iframe()
leaveIframe();