Aún no tienes acceso a esta clase

Crea una cuenta y continúa viendo este curso

Controles dinámicos

18/24
Recursos

Aportes 26

Preguntas 5

Ordenar por:

¿Quieres ver más aportes, preguntas y respuestas de la comunidad? Crea una cuenta o inicia sesión.

Si les cuesta leer la pausa explicita siempre pueden formatear su codigo asi

WebDriverWait(driver, 15).until(
            EC.element_to_be_clickable((By.CSS_SELECTOR, '#checkbox-example > button'))
)

Excelente clase me quedo más claro que en la clase dedicado a Demora implicita y explicita. 😃

Les comparto el código de la clase por si alguien tiene problemas en el futuro:

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC #Esperas explicitas

class DynamicControls(unittest.TestCase):
    #Prepara entorno de la prueba. 
    def setUp(self):
        self.driver = webdriver.Chrome('chromedriver')
        driver = self.driver
        driver.get("http://the-internet.herokuapp.com/")
        driver.find_element_by_link_text('Dynamic Controls').click()



    #Casos de prueba
    def test_dynamic_controls(self):
        driver = self.driver
        checkbox = driver.find_element_by_css_selector("#checkbox > input[type=checkbox]")
        checkbox.click()

        remove_add = driver.find_element_by_css_selector("#checkbox-example > button")
        remove_add.click()
    
        #Webdriver wait (driver, espera). hasta que (EC.el elemento sea clickable(tupla)) tupla (por selector CSS, "Selector")
        WebDriverWait(driver,15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#checkbox > input[type=checkbox]")))
        remove_add.click()

        enable_disable_button = driver.find_element_by_css_selector("#input-example > button")
        enable_disable_button.click()

        WebDriverWait(driver,15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#input-example > button")))
        
        text_area = driver.find_element_by_css_selector("#input-example > input[type=text]")
        text_area.send_keys('Platzi')

        enable_disable_button.click()

    #Finalizar
    def tearDow(self):
        self.driver.quit() #Revisar con close


if __name__ == "__main__":
    unittest.main(verbosity=2)

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep

class DynamicControls(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.driver = webdriver.Chrome(executable_path=r'C:/Users/Usuario/Documents/platzi/python/Clases del Curso de Introducción a Selenium con Python/chromedriver.exe')
        driver = self.driver
        driver.get('https://the-internet.herokuapp.com/')
        driver.maximize_window()
        driver.find_element(By.LINK_TEXT, 'Dynamic Controls').click()

    def test_add_remove(self):
        driver = self.driver
        button_remove = driver.find_element(By.XPATH, '//*[@id="checkbox-example"]/button[contains(text(),"Remove")]')
        button_remove.click()
        
        button_add = WebDriverWait(driver=driver, timeout=10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="checkbox-example"]/button[contains(text(),"Add")]')))
        paragraph = driver.find_element(By.XPATH, '//*[@id="message"][contains(text(),"It\'s gone!")]')

        button_add.click()
        button_remove = WebDriverWait(driver=driver, timeout=10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="checkbox-example"]/button[contains(text(),"Remove")]')))
        paragraph = driver.find_element(By.XPATH, '//*[@id="message"][contains(text(),"It\'s back!")]')

    def test_enable_disable(self):
        driver = self.driver
        button_action = driver.find_element(By.XPATH, '//*[@id="input-example"]/button[contains(text(),"Enable")]')
        button_action.click()

        self.status_field(self.get_input())
        button_action.click()

        self.status_field(self.get_input())

    def get_input(self):
        return WebDriverWait(driver=self.driver, timeout=10).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="input-example"]/input')))


    def status_field(self, input_enable):
            sleep(3)
            if input_enable.is_enabled():
                print('The field  is enable.')
            else:
                print('The field is disable.')

    @classmethod
    def tearDownClass(self):
        driver = self.driver
        driver.close()
        driver.quit()

if __name__ == '__main__':
    unittest.main(verbosity=1)


Aquí esta el código actualizado, hay que hacerle unos cambios al css selector en el primer webdriver que usamos, ya que el css selector de remove no es el mismo que el de add 😄 ( agregue unos sleeps de mala practica abajo para que se logre ver la diferencia xD si pudiste quitar esos sleeps con algún webdriver me gustaría verlo UwU

from time import sleep
import unittest
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver

class DynamicControls(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path = r'inserta tu acceso rapido')
        driver = self.driver
        driver.get('inserte link')
        driver.find_element_by_link_text('Dynamic Controls').click()

    def test_dynamic_controls(self):
        driver = self.driver

        checkbox = driver.find_element_by_css_selector('#checkbox > input:nth-child(1)')
        checkbox.click()

        remove_add_button = driver.find_element_by_css_selector('#checkbox-example > button:nth-child(2)')
        remove_add_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#checkbox-example > button:nth-child(1)')))
        remove_add_button.click()

        enable_disable_button = driver.find_element_by_css_selector('#input-example > button:nth-child(2)')
        enable_disable_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#input-example > button:nth-child(2)')))

        text_area = driver.find_element_by_css_selector('#input-example > input:nth-child(1)')
        text_area.click()
        sleep(3)
        text_area.send_keys('Hola')
        sleep(3)

        enable_disable_button.click()

    def tearDown(self):
        self.driver.close()


if __name__ == '__main__':
    unittest.main()

Yo tuve un problema durante mi codificación y el error que me salía era que los elementos no tenían el atributo clic, pues son una lista dentro del site:

Lo que yo hice fue iterar dentro de la lista y ahí si darle click al elemento. Así:

checkboxs = driver.find_elements_by_css_selector("#checkbox > input[type=checkbox]")
        for checkbox in checkboxs:
            checkbox.click()

Luego de haber implementado esto, el código me funciono sin ningún problema.

Les dejo el código completo:

from lib2to3.pgen2 import driver
from pickletools import uint1
import unittest
from venv import create
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

class DynamicControls(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path = r'C://Users//saman//Downloads//Studies//Selenium_python//chromedriver_win32//chromedriver.exe')
        driver = self.driver
        driver.maximize_window()
        driver.get("Aquí va el site de prueba")
        driver.find_element_by_link_text('Dynamic Controls').click()

    def test_add_remove(self):
        driver = self.driver

        checkboxs = driver.find_elements_by_css_selector("#checkbox > input[type=checkbox]")
        for checkbox in checkboxs:
            checkbox.click()

        remove_add_buttons = driver.find_elements_by_css_selector('#checkbox-example > button')
        for remove_add_button in remove_add_buttons:
            remove_add_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR,'#checkbox-example > button')))
        remove_add_button.click()

        enable_disable_buttons = driver.find_elements_by_css_selector('#input-example > button')
        for enable_disable_button in enable_disable_buttons:
            enable_disable_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#input-example > button')))
        
        text_areas = driver.find_elements_by_css_selector('#input-example > input[type=text]')
        for text_area in text_areas:
            text_area.send_keys('Los amo familia')

        for enable_disable_button in enable_disable_buttons:
            enable_disable_button.click()

    def tearDown(self):
        self.driver.close()

if __name__ == "__main__":
    unittest.main(verbosity = 2)

Si tienen alguna otra duda, no duden en preguntar, aquí estamos para ayudarnos… ❤️

Muy entretenido la verdad. Me salió a la primera por suerte 😄

Comparto mi código

import unittest
from pyunitreport import HTMLTestRunner
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions as EC


from selenium.webdriver.chrome import options

class Dynamic_controls(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome("D:\webdriver-chrome/chromedriver.exe")
        driver = self.driver
        driver.implicitly_wait(50)
        driver.maximize_window()
        driver.get('https://the-internet.herokuapp.com/')
        driver.find_element_by_link_text("Dynamic Controls").click()

    def test_dynamic_controls(self):
        driver = self.driver
        checkbox = driver.find_element_by_css_selector("#checkbox > input[type=checkbox]")
        checkbox.click()

        remove_add_buttom = driver.find_element_by_css_selector("#checkbox-example > button")
        remove_add_buttom.click()

        WebDriverWait(driver,15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#checkbox-example > button")))
        remove_add_buttom.click()

        enable_desable_buttom = driver.find_element_by_css_selector("#input-example > button")
        enable_desable_buttom.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#input-example > button")))
        
        text_area = driver.find_element_by_css_selector("#input-example > input[type=text]")
        text_area.send_keys('Platzi')

        enable_desable_buttom.click()

    def tearDown(self):
        self.driver.quit()


if __name__ == "__main__":
    unittest.main(verbosity=2,testRunner=HTMLTestRunner(output="reportes", report_name="prueba_asssert"))


import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class DynamicControl(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path= './chromedriver')
        driver = self.driver
        driver.get('https://the-internet.herokuapp.com/')
        driver.find_element_by_link_text('Dynamic Controls').click()

    def test_check_box(self):
        driver = self.driver

        checkbox= driver.find_element_by_css_selector('#checkbox')
        checkbox.click()

        remove_add_button = driver.find_element_by_css_selector('#checkbox-example > button')
        remove_add_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#checkbox-example > button")))
        remove_add_button.click()

        enable_disable_button = driver.find_element_by_css_selector('#input-example > button')
        enable_disable_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#input-example > button')))
        
        text_area = driver.find_element_by_css_selector('#input-example > input[type=text]')
        text_area.send_keys('Jeyfred')

        enable_disable_button.click()
        

    def test_button_enabled(self):
        pass


    def tearDown(self):
        self.driver.close()


if __name__ == "__main__":
    unittest.main(verbosity = 2)

Este fue mi solución antes de ver la clase

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By # Helps get elements through selectors for interaction
from selenium.webdriver.support.ui import WebDriverWait # Helps uses expected conditions and explicit waits
from selenium.webdriver.support import expected_conditions as EC

class AddRemoveElements(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path='./chromedriver')
        driver = self.driver
        driver.get('Ya saben')
        driver.find_element_by_link_text('Dynamic Controls').click()
    
    def test_add_remove_checkbox(self):
        driver = self.driver
        remove_checkbox_btn = driver.find_element_by_xpath(
            '/html/body/div[2]/div/div[1]/form[1]/button'
            )
        remove_checkbox_btn.click()

        message = WebDriverWait(self.driver, 10).until(
            EC.visibility_of_element_located((By.ID, 'message')))
        
        if message.text == "It's gone!":
            add_checkbox_btn = remove_checkbox_btn
        
        add_checkbox_btn.click()

        message = WebDriverWait(self.driver, 10).until(
            EC.visibility_of_element_located((By.ID, 'message')))
        
        if message.text == "It's back!":
            print('Button removed and added successfully!')
            checkbox = driver.find_element_by_id('checkbox')
            checkbox.click()
            WebDriverWait(self.driver, 10).until(
            EC.element_to_be_selected(checkbox))
        
    def test_enable_disable_input(self):
        driver = self.driver
        enable_input_btn = driver.find_element_by_xpath(
        '/html/body/div[2]/div/div[1]/form[2]/button'
        )
        enable_input_btn.click()

        input_xpath = '/html/body/div[2]/div/div[1]/form[2]/input'

        input = WebDriverWait(self.driver, 10).until(
            EC.element_to_be_clickable((By.XPATH, input_xpath)))

        if input.is_enabled:
            disable_input_btn = enable_input_btn
            input.send_keys("It's working!")
        
        disable_input_btn.click()
        
        message = WebDriverWait(self.driver, 10).until(
            EC.visibility_of_element_located((By.ID, 'message')))
        
        if message.text == "It's disabled!":
            print('Button enabled and disabled successfully!')
 
    def tearDown(self):
        self.driver.quit()

if __name__ == '__main__':
    unittest.main(verbosity=2)

Comparto mi solución. Tal vez falta optimizar algunas cosas. Pero es funcional.

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.support.wait import WebDriverWait


class Reto3(unittest.TestCase):

    def setUp(self) -> None:
        self.driver = webdriver.Edge(executable_path="./msedgedriver.exe")
        driver = self.driver
        driver.maximize_window
        driver.get("https://the-internet.herokuapp.com")

    def test3(self):

        self.driver.find_element_by_link_text("Dynamic Controls").click()

        self.driver.find_element_by_xpath('//*[@id="checkbox"]/input').click()

        self.driver.find_element_by_xpath(
            '//*[@id="checkbox-example"]/button').click()

        button_remove = WebDriverWait(self.driver, 10).until(
            EC.element_to_be_clickable((By.XPATH, '//*[@id="checkbox-example"]/button')))
        button_remove.click()

        WebDriverWait(self.driver, 10).until(
            EC.element_to_be_clickable((By.XPATH, '//*[@id="checkbox-example"]/button')))

        button_activate_deactivate = self.driver.find_element_by_xpath(
            '//*[@id="input-example"]/button')
        button_activate_deactivate.click()

        test = WebDriverWait(self.driver, 10).until(
            EC.element_to_be_clickable(
                (By.XPATH, '//*[@id="input-example"]/input')))

        test.send_keys("Hola")
        button_activate_deactivate.click()

        WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
            (By.XPATH, '//*[@id="input-example"]/button')))

    def tearDown(self) -> None:
        self.driver.close()


if __name__ == "__main__":
    unittest.main(verbosity=2)


Reto

from os import remove
import unittest

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions

from common import SERVICE
from common import CHROME_OPTIONS

class DynamicElementsTestCase(unittest.TestCase):

    @classmethod
    def setUpClass(cls) -> None:
        cls.driver = webdriver.Chrome(
            service=SERVICE,
            options=CHROME_OPTIONS,
        )
        cls.driver.get('https://the-internet.herokuapp.com/dynamic_controls')
        cls.driver.maximize_window()
        cls.driver.implicitly_wait(1)

    def test_async_remove_add(self):
        remove_add_button: WebElement
        remove_add_button = self.driver.find_element(By.XPATH, '//*[@id="checkbox-example"]/button')
        self.assertEqual(remove_add_button.text, 'Remove')
        self.driver.find_element(By.ID, 'checkbox')

        # Remove
        remove_add_button.click()
        WebDriverWait(self.driver, 20).until(expected_conditions.element_to_be_clickable((By.XPATH, '//*[@id="checkbox-example"]/button')))
        self.assertEqual(remove_add_button.text, 'Add')
        
        # Add
        remove_add_button.click()
        WebDriverWait(self.driver, 20).until(expected_conditions.element_to_be_clickable((By.XPATH, '//*[@id="checkbox-example"]/button')))
        self.assertEqual(remove_add_button.text, 'Remove')
        self.driver.find_element(By.ID, 'checkbox')

    def test_async_enable_disabled(self):
        toggle_button: WebElement
        toggle_button = self.driver.find_element(By.XPATH, '//*[@id="input-example"]/button')
        self.assertEqual(toggle_button.text, 'Enable')
        self.assertFalse(self.driver.find_element(By.XPATH, '//*[@id="input-example"]/input').is_enabled())

        # Enable
        toggle_button.click()
        WebDriverWait(self.driver, 10).until(expected_conditions.invisibility_of_element_located((By.XPATH, '/html/body/div[2]/div/div[1]/form[2]/div')))
        
        self.assertEqual(toggle_button.text, 'Disable')
        self.assertTrue(self.driver.find_element(By.XPATH, '//*[@id="input-example"]/input').is_enabled())

        # Disable
        toggle_button.click()
        WebDriverWait(self.driver, 10).until(expected_conditions.invisibility_of_element_located((By.XPATH, '/html/body/div[2]/div/div[1]/form[2]/div')))
        self.assertEqual(toggle_button.text, 'Enable')
        self.assertFalse(self.driver.find_element(By.XPATH, '//*[@id="input-example"]/input').is_enabled())

    @classmethod
    def tearDownClass(cls) -> None:
        cls.driver.quit()


if __name__ == '__main__':
    unittest.main(verbosity=2)

Para los que se siguen preguntando ¿Por que hay que agregar otro paréntesis cuando utilizamos By? es porque esta como parámetro del método "EC.element_to_be_clickeable()" y dentro se pasa una TUPLA donde usamos "By.<SEARCH_METHOD>, <texto>" , ya sabemos que las tuplas están dentro de “()”

O bueno eso entiendo yo 😜

Me salió, y hasta puse que ponga el texto ‘Hecho’ en la barra que se activa

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep


class ExplicitWaitTest(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')
        driver = self.driver
        driver.maximize_window()
        driver.get('https://the-internet.herokuapp.com/')
        driver.find_element_by_link_text('Dynamic Controls').click()

    def test_clickable_checkbox(self):
        driver = self.driver
        remove_checkbox = driver.find_element_by_xpath('/html/body/div[2]/div/div[1]/form[1]/button')
        remove_checkbox.click()

        add_checkbox = WebDriverWait(self.driver, 8).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div/div[1]/form[1]/button')))
        add_checkbox.click()

    def test_enable_bar(self):
        driver = self.driver
        enable_bar = WebDriverWait(self.driver, 8).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div/div[1]/form[2]/button')))
        enable_bar.click()

        bar = WebDriverWait(self.driver, 8).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div/div[1]/form[2]/input')))
        bar.click()
        bar.send_keys('Hecho')
        sleep(3)

        disable_bar = WebDriverWait(self.driver, 8).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div/div[1]/form[2]/button')))
        disable_bar.click()

    def tearDown(self):
        self.driver.close()

if __name__ == '__main__':
    unittest.main()

si sabes utilizar los xpath son igualmente buenos como los selectores de css

code

import unittest
from pyunitreport import HTMLTestRunner
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class CompareProducts(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path='./chromedriver')
        driver = self.driver
        driver.implicitly_wait(30)
        driver.maximize_window()
        driver.get('https://the-internet.herokuapp.com/')
        driver.find_element_by_link_text('Dynamic Controls').click()


    def test_Dynamic_controls(self):
        driver = self.driver

        checkbox = driver.find_element_by_css_selector('#checkbox > input[type=checkbox]')            
        checkbox.click()

        remove_add_button = driver.find_elements_by_css_selector('#checkbox-example > button')
        remove_add_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#checkbox-example > button')))
        remove_add_button.click()

        enable_disable_button = driver.find_element_by_css_selector('#input-example > button')
        enable_disable_button.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#input-example > button')))

        text_area = driver.find_element_by_css_selector('#input-example > input[type=text]')
        text_area.send_keys('cuack')

        enable_disable_button.click()


    def tearDown(self):
        self.driver.close()

if __name__ == '__main__':
    unittest.main(verbosity=2, testRunner= HTMLTestRunner(output= 'reports', report_name= 'hello-world-report'))

Me marcaba error si utilizaba el css_selector para la variable checkbox , en su lugar usé el xpath y así si me funcionó.

Al inicio del video no me quedó claro que tenía que lograr exactamente pero aquí está mi código que juega clickando botones y escribiendo cosas en el sitio.

import unittest
from pyunitreport import HTMLTestRunner
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class WaitUntil(unittest.TestCase):

    @classmethod
    def setUp(cls):
        options = Options()
        options.binary_location = '/snap/brave/119/opt/brave.com/brave/brave'
        cls.driver = webdriver.Chrome(options = options, executable_path="./chromedriver")
        driver = cls.driver
        driver.get("https://the-internet.herokuapp.com/dynamic_controls")
        driver.maximize_window()
    
    def test_wait_until(self):
        driver = self.driver

        #Checkbox thing
        checkbox = driver.find_element_by_css_selector("#checkbox-example input")
        checkbox.click()

        driver.find_element_by_css_selector("#checkbox-example button").click()
        WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.ID,"message"),"It's gone!"))

        driver.find_element_by_css_selector("#checkbox-example button").click()
        WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.ID,"message"),"It's back!"))

        checkbox = driver.find_element_by_css_selector("#checkbox-example input")
        checkbox.click()

        #Text input thing
        driver.find_element_by_css_selector("#input-example button").click()
        tinput = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#input-example input")))
        tinput.clear()
        tinput.send_keys("Hola mundo")
        driver.find_element_by_css_selector("#input-example button").click()

        WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.CSS_SELECTOR,"#input-example #message"),"It's disabled!"))
        driver.find_element_by_css_selector("#input-example button").click()

        tinput = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"#input-example input")))
        tinput.clear()
        tinput.send_keys("Adios mundo cruel")

    @classmethod
    def tearDown(cls):
        cls.driver.quit()

if __name__ == "__main__":
    unittest.main(verbosity=2, testRunner=HTMLTestRunner(output="reportes", report_name="automatic_search"))

Aqui la pagina por si la perdiste:

esta por mucho ha sido la mejor clase de ejemplo que hemos tenido hasta el moento, puesto que se explica mucho pero mucho mejor las pausas explicitas muchas gracias, hector daniel tienes tremendo don de enseñanza 😄

Interesantes ejercicios, gracias!

import unittest
from selenium import webdriver
from api_data_mock import ApiDataMock
from selenium.webdriver.support.ui import Select # Modulo para poder seleccionar del dropdown
from time import sleep
from selenium.webdriver.common.by import By #Hacer referencia a un elemento del sitio web, para interactuar
from selenium.webdriver.support.ui import WebDriverWait # Modulo para  manejo de esperas explicitas
from selenium.webdriver.support import expected_conditions as EC #esperas explicitas




class DynamicControls(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome(executable_path = r'./chromedriver.exe')
        driver = self.driver
        # driver.implicitly_wait(30)
        driver.maximize_window()
        driver.get('') # Colocar la pagina web
        driver.find_element_by_link_text('Dynamic Controls').click()
        

    def test_dynamic_controls(self):
        driver = self.driver
        checkbox = driver.find_element_by_css_selector('#checkbox > input:nth-child(1)')
        checkbox.click()
        
        remove_add_buttom = driver.find_element_by_css_selector('#checkbox-example > button:nth-child(2)')
        remove_add_buttom.click()

        WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR,'#checkbox > input:nth-child(1)')))
        remove_add_buttom.click()
        
        

        enable_disable_button = driver.find_element_by_css_selector('#input-example > button:nth-child(2)')
        enable_disable_button.click()

        WebDriverWait(driver,15).until(EC.element_to_be_clickable((By.CSS_SELECTOR,'#input-example > button:nth-child(2)')))
        text_area = driver.find_element_by_css_selector('#input-example > input:nth-child(1)')
        text_area.send_keys('DBZ DBZ DBZ DBZ')
        enable_disable_button.click()

        sleep(5)

        
            


    def tearDown(self):
        self.driver.implicitly_wait(5)
        self.driver.close()


   
if __name__ == '__main__':
    unittest.main(verbosity=2)```

Me parece que el código de la clase quedaría mejor así:

def test_addRemoveCheckBox(self):
    driver = self.driver

    #Conseguir los elemetos
    check_box = driver.find_element_by_css_selector('#checkbox')
    add_remove_button = driver.find_element_by_css_selector('#checkbox-example > button')

    #Interactuar con los elementos
    check_box.click()
    add_remove_button.click()
    WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#checkbox')))
    add_remove_button.click()


  def test_write_in_input_field(self):
    driver = self.driver

    #Conseguir los elemetos
    enable_disable_button = driver.find_element_by_css_selector('#input-example > button')
    input_field = driver.find_element_by_css_selector('#input-example > input[type=text]')

    #Interactuar con los elementos
    enable_disable_button.click()
    WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#input-example > button')))
    input_field.clear() #En caso de que tenga texto escrito
    input_field.send_keys('Platzi')
    enable_disable_button.click()

Queda dividido en 2 pruebas, me parece que es más fácil de mantener y leer este código.

aquí dejo mi solución

import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class dinamic_Controls(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.driver = webdriver.Chrome(executable_path=r'C:/chromedriver.exe')
        driver = cls.driver
        driver.maximize_window()
        driver.get('http://the-internet.herokuapp.com/')
        driver.implicitly_wait(10)
        driver.find_element_by_link_text('Dynamic Controls').click()

    def test_prueba1(self):
        driver = self.driver
        delay = 15
        xpath_checkbox = '//div/input[@type="checkbox"]'
        xpath_button = '//form[@id="checkbox-example"]/button'
        driver.find_element_by_xpath(xpath_checkbox).click()
        driver.find_element_by_xpath(xpath_button).click()
        for i in range(0,3):
            WebDriverWait(driver, delay).until(EC.element_to_be_clickable((By.XPATH, xpath_button))).click()
            WebDriverWait(driver, delay).until(EC.element_to_be_clickable((By.XPATH, xpath_checkbox))).click()
            WebDriverWait(driver, delay).until(EC.element_to_be_clickable((By.XPATH, xpath_button))).click()

    def test_prueba2(self):
        driver = self.driver
        delay = 15
        xpath_button = '//form[@id="input-example"]/button'
        xpath_text_field = '//form[@id="input-example"]/input'
        for i in range(0, 3):
            WebDriverWait(driver, delay).until(EC.element_to_be_clickable((By.XPATH, xpath_button))).click()
            disable_button = WebDriverWait(driver, delay).until(EC.element_to_be_clickable((By.XPATH, xpath_button)))
            text_area = driver.find_element_by_xpath(xpath_text_field)
            text_area.clear()
            text_area.send_keys(f'una palabra {i}')
            disable_button.click()


    @classmethod
    def tearDownClass(cls):
        cls.driver.quit()

if __name__ == '__main__':
    unittest.main(verbosity=2)

Saludos chicos, les dejo el codigo de la clase con comentarios explicando cada uno de sus pasos:

import unittest
from selenium import webdriver

#Modulos para manejar esperas dinamicas
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class DynamicControls(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Firefox(executable_path= r'./geckodriver.exe')
        driver = self.driver
        driver.implicitly_wait(10)
        driver.maximize_window()
        driver.get('https://the-internet.herokuapp.com/')
        driver.find_element_by_link_text('Dynamic Controls').click()

    def test_dynamic_controls(self):

        driver = self.driver

        #Buscar el checkbox por su selector de CSS
        checkbox = driver.find_element_by_css_selector('#checkbox > input[type=checkbox]')
        checkbox.click()

        #Boton de remover
        button_remove = driver.find_element_by_css_selector('#checkbox-example > button')
        button_remove.click()

        #Condicion de espera
        WebDriverWait(driver,5).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#checkbox-example > button')))
        button_remove.click()

        #Boton de activar y desactivar
        enable_button = driver.find_element_by_css_selector('#input-example > button')
        enable_button.click()

        #Tiempo de espera para verificar la activacion del text area
        WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#input-example > button')))

        #Identificar text area o textbox
        text_area = driver.find_element_by_css_selector('#input-example > input[type=text]')
        text_area.send_keys('hello')

        #Desactivar el boton
        enable_button.click()

    def tearDown(self):
        driver = self.driver
        driver.close()

if __name__ == '__main__':
    unittest.main()```

Hola!
tengo problemas con el acceso de click para el check box, no lo reconoce 😦
asi tengo el codigo

check_box = driver.find_element_by_id('checkbox')
check_box.click()

ya trate encontrandolo con id, css selector y xpath, no funciona con ninguna simplemente lo pasa por alto y no lo selecciona, y es mas lo llamo despues de regresarlo y ahi si me sale un error

y sigamos aprendiendo u.u