Complete the code to capture a screenshot during a Selenium test.
driver.[1]('screenshot.png')
The save_screenshot method saves the current browser window as an image file, which helps collect evidence during debugging.
Complete the code to get the current page source for debugging.
page_source = driver.[1]The page_source property returns the HTML source of the current page, useful for inspecting page content during debugging.
Fix the error in the code to save browser logs for debugging.
logs = driver.get_log('[1]')
The correct log type to retrieve browser console logs is 'browser'. Using other strings causes errors or empty results.
Fill both blanks to wait until an element is visible before interacting.
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC wait = WebDriverWait(driver, 10) element = wait.until(EC.[1]((By.[2], 'submit-button')))
Use visibility_of_element_located to wait until the element is visible, and ID to specify the locator type for the element's ID.
Fill all three blanks to collect a screenshot, page source, and browser logs for debugging.
driver.[1]('debug.png') source = driver.[2] logs = driver.get_log('[3]')
Use save_screenshot to save the screenshot, page_source to get the HTML, and 'browser' to get the browser logs.