Heads up! If you are using Selenium 4+ for your code, you will have to change compared to what I show you in the next video:button = chrome_browser.find_element_by_class_name('btn-default')
When you see the above line of code, you will need to update it to (method name has changed):button = chrome_browser.find_element(By.CLASS_NAME, 'btn-default')
A few of the other methods have been updated so if you are using Selenium 4+ here is the code for you with the updates and some extra things (like removing the popup) that you can use as a reference for the rest of this section:
from selenium import webdriver from selenium.webdriver.common.by import By import time chrome_browser = webdriver.Chrome() chrome_browser.maximize_window() chrome_browser.get('https://demo.seleniumeasy.com/basic-first-form-demo.html') # This solves the issue with the Popup for those that encounter it: chrome_browser.implicitly_wait(2) popup =chrome_browser.find_element(By.ID, 'at-cv-lightbox-close') popup.click() user_message = chrome_browser.find_element(By.ID, 'user-message') user_message.clear() user_message.send_keys('I AM EXTRA COOOOL') time.sleep(2) show_message_button = chrome_browser.find_element(By.CLASS_NAME, 'btn-default') show_message_button.click() output_message = chrome_browser.find_element(By.ID, 'display') assert 'I AM EXTRA COOOOL' in output_message.text