Help using EVAL and document.getElementsByClassName

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Help using EVAL and document.getElementsByClassName

by alex1231 on Sat Aug 27, 2016 7:33 am

Hello,

I am trying to get the value of an element by its class name.

I can get the correct value with javascript:
Code: Select all
javascript:alert(document.getElementsByClassName('xx-large')[1].innerHTML)

or
Code: Select all
javascript:var a=eval(document.getElementsByClassName('xx-large')[1].innerHTML); alert(a);


But for some reason I can't get it to work properly in iMacros.

I tried
Code: Select all
SET !VAR1 EVAL("var a=document.getElementsByClassName(\\'xx-large\\')[1].innerHTML; a;");


and every other workaround that I could think of, but I just can't seem to get it right. Could you please help me?
I'd like to be able to get it into a variable because I would like to write the values to a .csv file afterwards.

Thanks a lot, it would really help.
alex1231
 
Posts: 1
Joined: Sat Aug 27, 2016 7:27 am

Return to General Support & Discussions

Who is online

Users browsing this forum: No registered users and 7 guests

-->