Javascript Simulate User Interaction Flow