Introduction: Master Selenium Web Interactions for Automation
Learn to interact with web elements effectively in Selenium. These 30 MCQs cover working with input boxes, buttons, links, checkboxes, radio buttons, dropdowns, and the Select class for web automation.
setValue()sendKeys()type()inputText()clickButton()press()click()actionClick()getText()retrieveText()fetchText()extractText()By.xpathBy.linkTextBy.cssSelectorBy.partialLinkTextclear() in Selenium?submitForm()sendKeys(Keys.ENTER)submit()pressEnter()isDisplayed() method check?NoSuchElementExceptionElementNotFoundExceptionLocatorNotFoundExceptionInvalidElementExceptiongetValue()getAttribute()fetchAttribute()attribute()pressKey()sendKeys()typeKey()simulateKey()selectCheckbox()click()setChecked()check()isChecked()isSelected()isEnabled()isClicked()selectRadio()click()setRadio()choose()By.idBy.classNameBy.cssSelectorBy.xpathuncheck()click()setUnchecked()click()isEnabled() method in Selenium check?findElements() to get a list of all checkboxesfindElement() and loop through checkboxesselectAllCheckboxes()getAllCheckboxes()By.xpath with the value attributeBy.cssSelector with the value attributeBy.idtoggle()click()switch()setChecked()isClickable()isEnabled()canBeClicked()isInteractable()DropdownSelectDropdownHandlerWebDropdownselectByText()selectByVisibleText()chooseByText()pickByText()selectByIndex()chooseByIndex()pickByIndex()selectOptionByIndex()selectByValue()selectOptionByValue()selectValue()chooseValue()getOptions()retrieveOptions()fetchOptions()listOptions()isMultiple() method of the Select class check?deselectAll()clearAllSelections()resetAll()removeAll()deselectByText()deselectByVisibleText()removeByText()unselectByText()forEach on getOptions()getOptions()listAllOptions()getSelectedOption()getFirstSelectedOption()getActiveOption()fetchSelectedOption()| Qno | Answer |
|---|---|
| 1 | b) sendKeys() |
| 2 | c) click() |
| 3 | a) getText() |
| 4 | b) By.linkText |
| 5 | b) To remove text from an input box |
| 6 | c) submit() |
| 7 | b) If an element is visible on the page |
| 8 | a) NoSuchElementException |
| 9 | b) getAttribute() |
| 10 | b) sendKeys() |
| 11 | b) click() |
| 12 | b) isSelected() |
| 13 | b) click() |
| 14 | d) By.xpath |
| 15 | d) Selenium does not require a special method; use click() |
| 16 | b) If a web element is clickable |
| 17 | a) Use findElements() to get a list of all checkboxes |
| 18 | c) Both a and b |
| 19 | b) click() |
| 20 | b) isEnabled() |
| 21 | b) Select |
| 22 | b) selectByVisibleText() |
| 23 | a) selectByIndex() |
| 24 | a) selectByValue() |
| 25 | a) getOptions() |
| 26 | a) If a dropdown allows multiple selections |
| 27 | a) deselectAll() |
| 28 | b) deselectByVisibleText() |
| 29 | c) Both a and b |
| 30 | b) getFirstSelectedOption() |