What is difference between WebDriver click() and JavaScript click()?

Member

sidney

by sidney , in category: Technology , 2 months ago

What is difference between WebDriver click() and JavaScript click()?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by irwin , 2 months ago

WebDriver click() simulates real user interaction with the UI. I will be performed (in most browsers) by sending a native event to the browser, and it has to be visible in order to click on it.

JavaScript click() on the other hand, executes JavaScript in the context of the currently selected frame or window.

Note: Regardless if the WebElement is visible or not. This approach misses the idea of user interaction Selenium tries to simulate.