Call JavaScript Function in HTML page

Post here if you need help using Actiona
Post Reply
DanRobott
Posts: 3
Joined: 29 Nov 2017, 14:23

Call JavaScript Function in HTML page

Post by DanRobott »

Hello everybody!

I´m developing a robot to copy data from a HTML web page.

The page contains DIVs that shows/hides some information.

The <A HREF> (HTML Code) calls a JS function to show/hide that information.

Is there a way from the "CODE" Action to interact with the page and call that JS Funtion?

I tried to create a new object from the window and used this code, but it didn't work:

Code: Select all

function(Call_JS){
	var btnCtrls=document.getElementsByTagName('A');
	for(i=0;i<btnCtrls.length;i++){
		if(btnCtrls[i].text=='QUERY'){
			btnCtrls[i].click();
			break;
		}
	}
}
Thanks in advance!
:wink:
eureka
Posts: 204
Joined: 08 Mar 2016, 22:18

Re: Call JavaScript Function in HTML page

Post by eureka »

I don't yet interact with web pages (Selenium does that) but I gave some thought to how I might approach this.
Normally I would use curl to scrape web page content.
Is the web page under your control or created elsewhere?

In Chromium browser I read about creating a new extension.
I followed the example here to register an example extension.

https://developer.chrome.com/extensions/getstarted

This creates a clickable button "Getting started example" in browser top bar which can trigger access to html dom.

Would this approach work for you? You would use Actiona to target the button icon in browser.
DanRobott
Posts: 3
Joined: 29 Nov 2017, 14:23

Re: Call JavaScript Function in HTML page

Post by DanRobott »

That´s a great idea!
I´ll have a try...
Thanks a lot for the support!
eureka
Posts: 204
Joined: 08 Mar 2016, 22:18

Re: Call JavaScript Function in HTML page

Post by eureka »

I've remembered another extension which I installed for testing.

http://chrome-automation.com/
Post Reply