Skip to main content
Solved

Getting FME to fire an onclick event

  • June 21, 2018
  • 3 replies
  • 78 views

I have what seems like a simple thing I need to do. I have a webpage with a java button on it. The result of pressing that button downloads an xls file that is the data I need. I'd like FME to be able to go to that URL and press that button, but I can't figure out how to get the HTTPCaller to hand the java code and then capture any response. Maybe it's not the HTTPCaller I need?

I'm pretty new to FME.

The URL is inside a fire wall, but it's a basic https URL.

Inspecting the button shows this code.

<button title="Excel" onclick="cfExportData('xls', 146014343, 'WorkItemEvents:146014343', 'WorkItem,EventName,EventStartDate,Notes', '')">XLS</button>

What do I need to do to hand FME a static URL and get it to run this cfExportData command from above and then capture the resulting file download?

Any tips/help would be great. Thanks

Best answer by geosander

Like Takashi already mentioned, I think your best bet is to you figure out what the JavaScript (you say Java, but I guess you mean JavaScript?) function does, if you have access to the code (it's usually in a .js file which can be downloaded via a URL in the HTML source).

It FME is running on a server it is highly likely that it calls the workspace using the REST API. In that case, the HTTP URL to that REST endpoint will be mentioned or called in the JavaScript code somewhere. That same URL can then be used by an HTTPCaller.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

takashi
Celebrity
  • 7842 replies
  • June 22, 2018

Hi @anthony1, I don't think the current FME has a capability to directly execute a JavaScript script written in a web page.

If the definition of the function "cfExportData" was published, you could know how the function work when the button is pressed. However, whether you could emulate the behavior with FME depends on the implementation.


geosander
Forum|alt.badge.img+7
  • 327 replies
  • Best Answer
  • June 22, 2018

Like Takashi already mentioned, I think your best bet is to you figure out what the JavaScript (you say Java, but I guess you mean JavaScript?) function does, if you have access to the code (it's usually in a .js file which can be downloaded via a URL in the HTML source).

It FME is running on a server it is highly likely that it calls the workspace using the REST API. In that case, the HTTP URL to that REST endpoint will be mentioned or called in the JavaScript code somewhere. That same URL can then be used by an HTTPCaller.


  • Author
  • 1 reply
  • June 22, 2018

Yes, javascript. I managed to find a URL builder for this particular javascript, so I was able to manually make a URL that the button was making when pressed. Thanks for the input guys.