Retrieve Information from a Table

The aim here is to interact with the DOM through the Chrome DevTools console, and to work through the process of retrieving elements with different locators. The steps for completion are as follows:

  1. Open https://trainingbypackt.github.io/Beginning-Selenium/lesson_4/activity_4_A-1.html, and inspect it through the DevTools JavaScript console.
  2. Count all of the names and print them in the console:
document.getElementsByClassName('name').length
> 3
  1. Print each of the names, and access each element through its index:
document.getElementsByClassName('name')[0].innerHTML
> "John"
document.getElementsByClassName('name')[1].innerHTML
> "Mary"
document.getElementsByClassName('name')[2].innerHTML
> "Peter"
  1. Repeat steps 2 and 3 to print each of the last names and emails.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.144.69