0
0
Selenium Javatesting~10 mins

findElement by partialLinkText 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 find an element using partial link text.

Selenium Java
WebElement link = driver.findElement(By.[1]("Learn"));
Drag options to blanks, or click blank then click option'
Aname
BlinkText
Cid
DpartialLinkText
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'linkText' instead of 'partialLinkText' which requires full text match.
Using 'id' or 'name' which are not for link text.
2fill in blank
medium

Complete the code to click on a link found by partial link text.

Selenium Java
driver.findElement(By.[1]("Contact")).click();
Drag options to blanks, or click blank then click option'
Aid
BpartialLinkText
CcssSelector
DclassName
Attempts:
3 left
💡 Hint
Common Mistakes
Using locators like 'id' or 'className' which do not match link text.
Forgetting to call click() after finding the element.
3fill in blank
hard

Fix the error in the code to correctly find a link by partial link text.

Selenium Java
WebElement element = driver.findElement(By.[1]("About Us"));
Drag options to blanks, or click blank then click option'
ApartialLinkText
Blinktext
Cpartiallinktext
DlinkText
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect casing like 'linktext' or 'partiallinktext'.
Using 'linkText' which requires full text match.
4fill in blank
hard

Fill both blanks to create a list of elements found by partial link text and print their count.

Selenium Java
List<WebElement> links = driver.findElements(By.[1]("Help"));
System.out.println(links.[2]());
Drag options to blanks, or click blank then click option'
ApartialLinkText
Bsize
Cget
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using get() instead of size() to get count.
Using click() on a list instead of an element.
5fill in blank
hard

Fill both blanks to find a link by partial link text, check if it is displayed, and print the result.

Selenium Java
WebElement link = driver.findElement(By.[1]("Sign"));
boolean visible = link.[2]();
System.out.println(visible);
Drag options to blanks, or click blank then click option'
ApartialLinkText
BisDisplayed
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to add extra characters after printing the boolean.
Using incorrect method names or missing parentheses.