javascript - How to call an action from PhantomJS, and do I have enough information already -


Consider a webpage that makes extensive use of JavaScript to display notifications.

& lt; Li class = "phobar blubber-action blah foo" data-a = "afu" data-b = "bar" & gt; & Lt; / Li & gt;

I am new to JavaScript, but I have identified the following in the JS source, which I consider to be relevant:

  events: {"This The code is nested in any other function:  
  define ("some / path / whatever / see some functions", ["backbone", "jquery", "template .. / Templates / whatever HBS "," ./ LayerFunctionView "," utils "," timemanager "," modal manager "], function (a, b, c, d, e, f, g) {return a.view.extend (Click on {events: {"click .foobar-action" R: "somefunction"}, some function: function (a) {var c = b (a.currentTarget), e = cdita ("family"); g. pen (new d ({date: this dataet, collision: this "Anything", "xxxx", "papin detail-popin whatever", offset: {x: 0, y: 0}, position: "Bump, Family P: e}), cipirant ()," some text ", {CssClass: , $ Target: c.parent (), mean: 200, category: "layer"}}}, render: function () {return it El. (C (this.prepareJson ()), it. DelegateEvents (), This}, ready Jason: function () {var a = {}; return a.blahUIData = e.serviceMapper.createUIFamiliesData (this.bump.woof), a.bump = this.bump, a.date = f .momentWithOffset (this.bump.heureD, this.bump.time ZoneOffset). Format (F.ft.DAY_MONTH_YEAR), a}, setBump: function (A, B) {this.date = a, return.bump = b, this}})}),  

My question is that Do I have enough information to get data from these boxes while using FontJJs, or should I move forward? And if I have enough, can someone tell me in the right direction how to get it?

There is no way to achieve the context of somefunction globally The scope is, so to trigger the function you need to click on the .foobar-action element (if I understood the event registration properly).

You can use the solution like this:

  Page. Evaluation (function () {var ev = document.createEvent ("MouseEvent"); Ev.initMouseEvent ("click", true, true, window, zero, 0, 0, 0, false, false, false, false, 0 , Zero); document.querySelector ("foobar action.") DispatchEvent (EV).}); SetTimeout (function () {// more code here}, 100);  

It seems that you will have to wait a little while until the page is ready to do anything else.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -