(greater than sign) after the div selector. Javascript - document.getElementById () method. It defaults to null. Note: To get all of the text and CDATA data for the whole document, one could use document.documentElement.textContent. 2.3.1. We can use the getText() method to handle such scenarios as well. Just like in selenium web driver, javascript also provides some methods to find the elements: getElementById. If you need to use this method to get text from multiple elements, the code would look something like this: $('h1').contents().each(function() { if (this.nodeType == 3) { // you could also simply do: $(this).text() console.log(this.textContent || this.innerText || ''); } }); /* Output: Hello World! The getComputedStyle () method accepts two arguments: element is the element that you want to return the computed styles. IE8 uses the innerText instead. Fill the text or content you want to copy in this