赞
踩
from selenium import webdriver
driver = webdriver.Chrome() # Replace with your preferred browser driver
driver.get("https://example.com") # Load the webpage
# Find the iframe element using XPath
iframe = driver.find_element_by_xpath("//iframe[@attribute='value']") # Replace attribute and value with appropriate values
# Switch to the iframe
driver.switch_to.frame(iframe)
# Perform actions within the iframe
# ...
# Switch back to the main content
driver.switch_to.default_content()
# Continue interacting with the main content
# ...
driver.quit()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。