0
0
Selenium Javatesting~10 mins

Hybrid framework architecture in Selenium Java - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the WebDriver in a hybrid framework.

Selenium Java
WebDriver driver = new [1]();
Drag options to blanks, or click blank then click option'
AFirefoxOptions
BChromeDriver
CWebElement
DActions
Attempts:
3 left
💡 Hint
Common Mistakes
Using FirefoxOptions instead of FirefoxDriver
Confusing WebElement with WebDriver
Trying to instantiate Actions directly as WebDriver
2fill in blank
medium

Complete the code to read test data from an Excel file in the hybrid framework.

Selenium Java
FileInputStream file = new FileInputStream("data.xlsx");
Workbook workbook = new [1](file);
Drag options to blanks, or click blank then click option'
ABufferedReader
BFileReader
CXSSFWorkbook
DSheet
Attempts:
3 left
💡 Hint
Common Mistakes
Using FileReader which is for text files
Using BufferedReader which reads text streams
Using Sheet which represents a sheet, not the workbook
3fill in blank
hard

Fix the error in the assertion statement to verify the page title.

Selenium Java
Assert.[1](driver.getTitle(), "Expected Title");
Drag options to blanks, or click blank then click option'
AassertNotNull
BassertTrue
CassertNull
DassertEquals
Attempts:
3 left
💡 Hint
Common Mistakes
Using assertTrue with two arguments causes compilation error
Using assertNull or assertNotNull is incorrect for title comparison
4fill in blank
hard

Fill both blanks to create a reusable method that clicks a button by locator in the hybrid framework.

Selenium Java
public void clickButton(By [1]) {
    driver.[2]([1]).click();
}
Drag options to blanks, or click blank then click option'
Alocator
BfindElement
Cclick
DBy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'click' as parameter name
Using driver.click() which does not exist
Using 'By' as parameter name instead of a variable
5fill in blank
hard

Fill all three blanks to create a data-driven test method that reads username and password from Excel and logs in.

Selenium Java
String username = sheet.getRow([1]).getCell([2]).getStringCellValue();
String password = sheet.getRow([1]).getCell([3]).getStringCellValue();
Drag options to blanks, or click blank then click option'
A1
B0
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using row 0 which is header row
Mixing up cell indexes for username and password