JavaScript OnCHange

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
mknoll1
Posts: 174
Joined: Fri Dec 23, 2005 4:14 pm

JavaScript OnCHange

Post by mknoll1 » Thu Nov 10, 2011 9:57 pm

LONG time user with Win 7 X64 and version 7.36 scripting edition on IE9.

Has any progress been made on gettign TAG commands to trigger onchange events? this POST and several others reccommend using winclick commands but this isn't really an option for selecting dates from a dropdown box or many other tasks that I use Imacros for on a daily basis.

HTML code:

Code: Select all

td align="Middle" colspan="3">
<select id="selectHighDateMonth" onchange="return selectHighDateMonth_onchange()" onfocus="" language="javascript" name="selectHighDateMonth">
this makes the selection but does not fire the onchange event:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:selectHighDateMonth CONTENT={{MONTH1}}
The result of not firing the onchange event is when the page is submitted the receiver does not recognize the choices I have made and sends the response as if I hadn't made any changes on the page.

This is happening on more and more websites that I am trying to automate and is causing major headaches for my project. Is there any reason that this can't be done or is it simply not high enough on the priority list?
anyoneyoubet
Posts: 4
Joined: Fri Nov 11, 2011 12:16 am

Re: JavaScript OnCHange

Post by anyoneyoubet » Sat Nov 12, 2011 12:43 am

I think you need to make the MONTH1 a var

Code: Select all

SET !EXTRACT NULL
TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:selectHighDateMonth EXTRACT=TXT
TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:selectHighDateMonth CONTENT={{!EXTRACT}}
SET !EXTRACT NULL
The first TAG should extract the month and then the second should tag on the month.
without the site I don't know if this is what you mean.
mknoll1
Posts: 174
Joined: Fri Dec 23, 2005 4:14 pm

Re: JavaScript OnCHange

Post by mknoll1 » Mon Nov 14, 2011 1:53 pm

Thanks for the response but MONTH1 is a variable that gets set programmatically when I initiate the macrobrowser through my application. The issue is that unlike most websites this site is not submitting the values of the selections on the page but rather a document constructed using javascript commands that only run when there is an "onchange" event which the macroplayer command of

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:selectHighDateMonth CONTENT={{MONTH1}}

or even

TAG POS=1 TYPE=SELECT FORM=ID:Export ATTR=ID:selectHighDateMonth CONTENT=3
does not trigger. The end result is that the underlying document is unchanged even though the script has gone through and made changes to the visible selections on the screen. Then when the document is submitted to the web server it does not match up with what is on the screen and I get the same result as if I had not made any selections on the screen.
Post Reply