Solved

Getting FME to fire an onclick event

  • 21 June 2018
  • 3 replies
  • 12 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

icon

Best answer by geosander 22 June 2018, 09:12

View original

3 replies

Userlevel 2
Badge +17

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.

Badge +7

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.

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.

Reply