Complete the code to find an element by its class name.
element = driver.find_element_by_[1]("button-primary")
The method find_element_by_class_name is used to locate an element by its class attribute.
Complete the code to find all elements with the class name 'item'.
elements = driver.find_elements_by_[1]("item")
find_element_by_class_name which returns only one element.The method find_elements_by_class_name returns a list of all elements with the given class.
Fix the error in the code to correctly find an element by class name.
element = driver.find_element_by_[1]("btn-primary")
The correct method name uses an underscore: class_name. Other variations cause errors.
Fill both blanks to find all elements with class 'active' and click the first one.
elements = driver.find_elements_by_[1]("active") elements[[2]].click()
Use class_name to find elements by class. The first element in a list is at index 0.
Fill all three blanks to find an element by class name, get its text, and assert it equals 'Submit'.
element = driver.find_element_by_[1]("submit-btn") text = element.[2] assert text [3] "Submit"
Use class_name to find the element. The text property gets the visible text. Use == to check equality in the assertion.