...

/

Working with JavaScript Events

Working with JavaScript Events

Learn how to work with JavaScript events using Selenium.

Invoke 'OnClick' JavaScript Event

Consider the following HTML source:

Press + to interact
<input type="text" name="person_name" onclick="$('#tip').show();"
onchange="change_person_name(this.value);"/>
<span id="tip" style="display:none; margin-left: 20px; color:gray;">
Max 20 characters</span>

On render, this will generate:

OnClick JavaScript event text field
OnClick JavaScript event text field

Whenever a user clicks on such a text field, the tip text 'Max 20 characters' ...