0

I am trying to use PhantomJS to open a popup that is normally called via a link and dump a picture of that popup. I have only found ways using id's but all of the links have the same id, same href value, and same title. The only difference between all of the links is a 3 letter code in the showpopup function that corresponds to the 3 letter link text.

How can this be done? Can I just fire the ShowPopup('XXX') function or will I need to figure out a way to actually click the link?

<a href="#" id="ShowInfoHref" title="ABC" onclick="ShowPopup('XXX');return false;">XXX</a>

This link will then open up the popup:

<div class="ui-dialog-content ui-widget-content" id="XXX" style="width: auto; min-height: 25.7667px; height: auto;">...code...</div>

Which I assume I think I can just have phantomjs screen dump that div correct?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Joe
  • 13
  • 3

1 Answers1

0

The easiest would be to simply call ShowPopup('XXX'):

page.evaluate(function(){
    ShowPopup('XXX');
});
setTimeout(function(){
    // do something with it
}, 1000);

You could also click the link with a specific attribute CSS selector a[onclick*="XXX"]. The [attribute*=value] selector matches the element where the attribute contains the value anywhere.

Community
  • 1
  • 1
Artjom B.
  • 61,146
  • 24
  • 125
  • 222