Complete the code to import the Selenium WebDriver module.
from selenium import [1]
The correct import is webdriver from the selenium package to use Selenium WebDriver.
Complete the code to define the BasePage class constructor with a driver parameter.
class BasePage: def __init__(self, [1]): self.driver = driver
The constructor takes driver as a parameter to control the browser.
Fix the error in the method to find an element by CSS selector.
def find_element(self, css_selector): return self.driver.find_element_by_[1](css_selector)
The correct method suffix is css_selector for find_element_by_css_selector in Selenium Python.
Fill both blanks to create a method that waits for an element to be visible using WebDriverWait and expected_conditions.
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC def wait_for_element(self, locator): wait = WebDriverWait(self.driver, [1]) return wait.until(EC.[2](locator))
The wait time is usually set to 10 seconds, and the expected condition to check visibility is visibility_of_element_located.
Fill all three blanks to create a method that clicks an element after waiting for it to be clickable.
def click_element(self, locator): wait = WebDriverWait(self.driver, [1]) element = wait.until(EC.[2](locator)) element.[3]()
We wait 15 seconds, use the expected condition element_to_be_clickable, then call the click() method on the element.