Switch to iframe by using switch_to.frame() method and index value.
Example:
Prompt_Alert_Popup.py
from selenium.webdriver.common.by import By from selenium import webdriver import time driver = webdriver.Chrome("/Users/admin/Documents/Others/Drivers/chromedriver.exe") # Using Chrome Driver driver.get("http://www.dummypoint.com/Frame.html") assert "Selenium Template" in driver.title ele = driver.find_elements(By.TAG_NAME, "iframe") # To display number of Iframes in web page print("List of iframe : ", len(ele)) # Switch to iframe by its index value time.sleep(2) driver.switch_to.frame(1) # After switching get the text from iframe using ID locator data = driver.find_element(By.ID,"framename") print("Frame Name is : ",data.text) time.sleep(2) driver.quit()