from selenium import webdriver
from selenium.webdriver.common.by import By
import time


baseUrl = "http://www.mclibre.org/consultar/htmlcss/html/html_objetos.html#iframe"
driver = webdriver.Firefox()
driver.maximize_window()
driver.get(baseUrl)

# Switch to frame using numbers
driver.switch_to.frame(0)

# Switch to frame using element
iframe = driver.find_element(By.XPATH, '//*[@id="iframe"]/div[1]/div[2]/iframe')
driver.switch_to.frame(iframe)
time.sleep(2)

#Print text
elementText = driver.find_element(By.XPATH, "/html/head/title/")
print(elementText.text)
time.sleep(2)

# Switch back to the parent frame
driver.switch_to.default_content()
driver.execute_script("window.scrollBy(0, 1000);")
time.sleep(2)


# '//iframe[contains(@src,"ejemplo_iframe.html")]'
@@ -101,74 +101,32 @@
 http
+s
 ://
-www.mclibre.org/consultar/htmlcss/html/html_objetos.html#iframe
+jqueryui.com/button/
 %22%0Adr
@@ -202,67 +202,8 @@
 l)%0A%0A
-# Switch to frame using numbers%0Adriver.switch_to.frame(0)%0A%0A
 # Sw
@@ -276,36 +276,25 @@
  '//
-*
+div
 %5B@id=%22
-iframe%22%5D/div%5B1%5D/div%5B2
+content%22
 %5D/if
@@ -413,19 +413,23 @@
 tml/
-head/title/
+body/div/button
 %22)%0Ap
@@ -605,55 +605,18 @@
 2)%0A%0A
-%0A# '//iframe%5Bcontains(@src,%22ejemplo_iframe.html%22)%5D'
+driver.quit()%0A

fix switch to iframe test