Skip to content Skip to sidebar Skip to footer

Calling Click() Function On Html Element In Jasmine-phantomjs Test

I run my tests with Karma and PhantomJS: INFO [karma]: Karma v0.12.32 server started at http://localhost:9876/ INFO [launcher]: Starting browser PhantomJS INFO [PhantomJS 1.9.8

Solution 1:

Ok. Bacause PhantomJS based on webkit, I have to create/send event like this:

  var cle = document.createEvent("MouseEvent");
  cle.initEvent("click", true, true);
  var elem = document.getElementById('hello-p');
  elem.dispatchEvent(cle);

Post a Comment for "Calling Click() Function On Html Element In Jasmine-phantomjs Test"