java javascript selenium selenium-webdriver

Selenium vs. Javascript click event

I was wondering what the differences are between calling the click() method of the WebElement versus finding the element by id and firing the click event with JavaScript.

Just to be clear in the first method I call the .click() of an instance of WebElement:;

The second technique is:


I’m interested in knowing all the differences between these two techniques for clicking web elements, and also advantages and disadvantages of each.