Python Syntax Basics
How does Python define the start and end of code blocks such as functions or loops?
- Using indentation (whitespace)
- Using curly braces {}
- Using parentheses ()
- Using square brackets []
- Using semicolons ;
Installing Selenium
Which command is used to install the Selenium package for Python using pip?
- pip install selenium
- python install selenium
- pip selenium install
- install selenium --pip
- selenium.pip install
Selenium Locators
What does the find_elements() method return when used in Selenium with Python?
- A list of all matching elements
- The first matching element
- A single string with element names
- The total number of elements
- A Boolean indicating presence
Waiting for Elements
What is an explicit wait in the context of Selenium WebDriver with Python?
- A wait that pauses until a specific condition is met for an element
- A fixed wait for a predetermined amount of time for all elements
- Waiting until all images are loaded on the page
- Waits that are set in the system configuration
- Waiting only for script execution to finish
Handling Browser Windows
Which method will close all browser windows and end the WebDriver session in Python Selenium?
- quit()
- close()
- stop()
- end()
- shutdown()
Dropdown Handling
Which class is primarily used to interact with dropdown lists in Selenium using Python?
- Select
- DropdownHandler
- OptionList
- ListBox
- DropdownSelect
Alerts
How do you accept a JavaScript alert in Selenium with Python?
- alert.accept()
- alert.confirm()
- driver.click_alert()
- alert.press_ok()
- alert.submit()
Navigation
Which method in Python Selenium WebDriver sends the browser to a specified URL?
- get()
- navigate()
- open()
- url()
- launch()
Attributes and Text
If element is a found WebElement, how do you retrieve the current value of its 'id' attribute in Python?
- element.get_attribute('id')
- element.attribute('id')
- element.get('id')
- element.id()
- element.attr('id')
Unittest Setup
In Python's unittest framework, which method runs once before any tests in a class?
- @classmethodndef setUpClass(cls):
- def setUp(self):
- @classmethodndef tearDownClass(cls):
- def preTest(self):
- def setUpAll():