Docsity

Funciones básicas de Selenium - Parte 1, Resúmenes de Socialización y Curso de la Vida

Vista previa parcial del texto

¡Descarga Funciones básicas de Selenium - Parte 1 y más Resúmenes en PDF de Socialización y Curso de la Vida solo en Docsity!

Funciones básicas de

Selenium – Parte 1

Mervin Díaz

  • Webdriver.{Navegador}
    • webdriver.Firefox()
    • webdriver.Chrome()
    • Webdriver.Ie() FIREFOX:
    • about:config Chrome:
    • chrome://about/ Mas Info:
    • https://www.howtogeek.com/139736/how-to-change-hidden-advanced-settings-in-any-browser/
    • https://hipertextual.com/2017/09/menu-oculto-google-chrome Mervin Díaz
  • Métodos del Webdriver:
    • self.driver = Webdriver.{Navegador}
      • self.driver.{metodos}
      • self.driver.get("http://www.python.org")
      • self.driver.close()
      • self.driver.quit()
      • self.driver.implicitly_wait(15)
      • self.driver.maximize_window() Tema relacionado CAPABILITIES, será abordado mas delante en el curso. Mervin Díaz
  • Métodos del FindElements:
    • find_element_by_id
    • find_element_by_name
    • find_element_by_xpath
    • find_element_by_link_text
    • find_element_by_partial_link_text
    • find_element_by_tag_name
    • find_element_by_class_name
    • find_element_by_css_selector MORE INFO: https://selenium-python.readthedocs.io/locating-elements.html Mervin Díaz
  • Usos:
    • Sintaxis:
      • self.driver.find_element_by_id(“id”)
      • self.driver.find_element(By.ID, “ID") Mervin Díaz
  • Sub métodos a los que podemos acceder vía find_element.
    • .clic()
    • .text
    • .clear()
    • Entre otros. Mervin Díaz

Funciones básicas de

Selenium – Parte 2

Mervin Díaz

  • También podemos seleccionar un conjunto de elementos.
  • Usos:
    • Sintaxis:
      • self.driver.find_elements_by_xpath(“xpath”)
      • self.driver.find_elements(By.Xpath, “xpath ") Esto devuelve un arreglo de todos los elementos que coincidan con la busqueda. Ver ejemplo en video. Mervin Díaz
  • Otras funciones Basicás:
    • Syntaxis:
      • driver.switch_to.frame({LOCALIZADOR})
      • driver.switch_to.parent_frame() Permite desplazarnos entre sitios o elementos incrustados en un sitio o app.
      • Sitio de practica: https://www.tutorialspoint.com/html/html_frames.htm Mervin Díaz
  • Otras funciones Básicas:
    • Syntaxis:
      • driver.switch_to.active_element Permite desplazarnos hasta el element activo. Mervin Díaz

Manejando Ventanas

Mervin Díaz

  • Manejador de ventanas:
    • Syntaxis:
      • driver.current_window_handle
        • Devuelve el identificador de la Ventana actual.
      • driver.switch_to.window(IDENTIFICADOR)
        • Hace switch hacia la Ventana cuyo identificador se le envie mediante la funcion.
      • Sitio de practica: http://www.echoecho.com/htmllinks10.htm Mervin Díaz

Expected Conditions &

Explicits Waits

Mervin Díaz

  • Metodos del Expected Conditions:
    • title_is
    • title_contains
    • presence_of_element_located
    • visibility_of_element_located
    • visibility_of
    • presence_of_all_elements_located
    • text_to_be_present_in_element
    • text_to_be_present_in_element_value
    • frame_to_be_available_and_switch_to_it
    • invisibility_of_element_located
    • element_to_be_clickable
    • staleness_of
    • element_to_be_selected
    • element_located_to_be_selected
    • element_selection_state_to_be
    • element_located_selection_state_to_be
    • alert_is_present Mervin Díaz