Ok I am pretty sure I am making some stupid mistake here. This is what I got. I want to use javascript to run an Imacro to open www.google.com.
var test;
test ="CODE:";
test +="SET !ERRORIGNORE YES "+"\n";
test +="URL GOTO=www.google.com "+"\n";
iimPlay(test)
As per #Bestmacros I changed the code for test.js to the code shown above. Putting this into chrome and firefox simply shows me the file, putting it into IE just reloads the page. Double clicking the .js file comes up with a compiler error.
line: 6
char: 1
error: Object expected
code: 800A138F
source: Microsoft JScript runtime error
Any suggestions?
Thank you.
i had the same problem but it worked after i had renamed the javascript filename and extension to lovercase.
Related
I wrote a simple test in VS Code while working on protractor and got an error while executing on the New Terminal
DevTools listening on ws://127.0.0.1:49813/devtools/browser/be6e2d14-8a42-4b12-8854-7f05dc686c0b
[5696:6260:0423/182116.847:ERROR:browser_switcher_service.cc(238)] XXX Init()
Can somebody help me in explaining why this error is coming
in my case, turns out I missed https:// part of the url. Once added, it fixed the problem
I'm using javascript and imacros to collect some data from a website and I have this line of code:
final_macro += "ADD !EXTRACT " + '"' + lager_col2[0].textContent + '"' + "\n";
When I ran my js in the browser I got this error:
Error: Accessing content window is not supported in multiprocess Firefox, line 208 (Error code: -991)
Should I be worried ? Is the use of textContent forbidden ?
The problem is that lager_col2[0] sometimes happen to be a link and I only want the text inside the link, not the tags and everything. So naturally I went with textContent. How could I get around this ?
Additionally, am I setting myself up for trouble when trying to access certain nodes with the use of window.document.getElementsByClassName?
Is it better to use iMACROS TAG POS/XPATH ?
The strange thing is I'm getting the exact same error that you are even down to the code line number. Obviously my JavaScript line numbers do not match yours. At first I thought the problems were caused by my recent upgrade to Firefox 48. But when I moved my imacros to another machine that is running Firefox 47 I got the exact same error as you.
Update: My workaround was to downgrade the Firefox iMacros extension from 9.0.3 to 8.9.7. Now my macro is working again with Firefox version 47 and iMacros version 8.9.7.
In similar cases I can suggest you one of my old workarounds with an additional function in order to get some window content:
var someContent = getSomeContent("document.getElementsByClassName('someclass')[0].textContent");
alert(someContent);
function getSomeContent(selector) {
var ret = iimPlayCode("URL GOTO=javascript:alert(" + selector + ");");
if (ret < 0)
return iimGetErrorText().match(/Dialog message: "([\s\S]*)",/)[1];
}
The idea seems to be helpful. But I haven't yet tested this script in multiprocess Firefox.
Reinstall plugin iMacros. It's helped me.
imacro does not support to access dom element please go back to older version of imacro older than imacro 9.
Firefox > 47.0.1 and iMacros > 8.9.7 not supported (because Firefox architecture changed)
Solve:
STEP 1. Remove add-on imacros if installed.
STEP 2. Uninstall Firefox.
STEP 3. Follow this link for download Firefox version Firefox 47.0.1. https://download-installer.cdn.mozilla.net/pub/firefox/releases/47.0.1/win32/en-US/Firefox%20Setup%2047.0.1.exe or this link https://support.mozilla.org/en-US/kb/install-older-version-of-firefox
STEP 4. Install Firefox 47.0.1 and after launch Firefox visit " about:support " .
STEP 5. You can see button "Refresh Firefox" click it and restart Firefox.
STEP 6. Follow this link to download iMacros version 8.9.7. https://addons.mozilla.org/en-US/firefox/addon/imacros-for-firefox/versions/
I can't figure out how to use imacros with JavaScript. I have looked at their Help, have seen countless examples here on Stack Overflow, but don't know what am missing. It has not been explained clearly anywhere.
Here is what I tried:
Used the example explained in their help file here:
http://wiki.imacros.net/JavaScript
But nothing happens when I click the 'Click Here to Run' link (even in IE with ActiveX). NOTE: I don't have imacros for IE - the example shown above has image of the macro start in IE, but run in Firefox. And no further explanation..
Tried to import a JS file into imacros, but it doesn't seem to be working for me.
When I use code like the following:
var macro;
macro = "CODE:";
macro += "XXXXXX" + "\n";
macro += "XXXXXX" + "\n";
....
iimPlay(macro);
It says:
"Error -1100: Unknown command: VAR at line: 1"
Tried to use the above inside a script tag of an HTML page, & load the functions on page-load/click. But that doesn't work either.
What am I doing wrong, and what do I need to do?
Soon after I posted this, I think I got it to work for a while. I was able to open a JS file which opened a URL. So I had deleted the Q. But now it isn't working again, and I can't figure out why.. Can somebody help?
Basically I am having the exact same problem as this person here:
Javascript and Imacro to Open Google.com I get the same 'unknown command: var' as him. And their question remains unresolved too.
It looks like you are trying to run javascript inside an iim file. Open notepad or another text editor and paste the following code:
var test;
test ="CODE:";
test +="SET !ERRORIGNORE YES "+"\n";
test +="URL GOTO=www.google.com "+"\n";
iimPlay(test)
Save the file with a .js extension. Next open up firefox and the iMacros addon. Go to Manage -> Settings -> Paths Tab -> Folder Datasource. Enter the path where you saved the file above. Refresh iMacros by clicking the iMacro button on and off. The javascript file should show up in the left pane. Run the file to test.
You should notice the icon to the left of the file name is different for the javascript files and the extension is ".js" instead of ".iim".
Good answer Creamstout83
I would also add this to answer above. Un checking this option will speed up the process. And checking it will enable better debugging.
If you're experiencing this problem while using Chrome to run iMacros; the answer is really simple:
Download Firefox and run the iMacros plugin on there.
I experienced the same problem, receiving the error message: "Error -1100: Unknown command: VAR at line: 1", while using Chrome.
But with Firefox I can now run javascript files, have more options to play around with, and less bugs to disrupt my scrapes.
I have several debug printouts in my script with console.log(message), but no messages displayed in Console section of Firebug.
What can be a reason for this?
UPDATE 1
Neither of console.warn, console.error and console.info works.
UPDATE 2
I have a following log function:
function log(message) {
console.error(message);
$("#log").append(message + "<br/>");
}
so it logs both into Firebug console and DIV on page. I see that DIV logging works. Hence the control reaches the statements.
UPDATE 3
--irrelevant--
UPDATE 4
Update 3 was irrelevant: consoleBody in firebug.js was not always null. Later it was becoming valued.
But I saw that the content of consoleBody contains "div#log". Probably it interferes with my naming...
UPDATE 5
Renaming of ID of my DIV didn't help...
UPDATE 6
Whe I do console.log("hehe") in immediate line of firebug, it prints undefined
UPDATE 7
Looks like console.log() does not work within Liferay portlet at all; even very simple hello world portlet does not excecute this command.
Use javascript.log.enabled=false property.
This will disable firebug lite, now console.log will log to browser's console.
I'm not sure what's the reason for such behaviour for 6.0 version but I have found the reason it doesn't work in 5.2.3.
It seems that Liferay includes Firebug Lite on my page and when I press F12 it appears at the bottom. It does interceps console method calls.
Now I'm looking for correct way to remove the included script.
EDIT:
Seems like the reason for this is that I have developer mode enabled.
set JAVA_OPTS=%JAVA_OPTS% -Dexternal-properties=portal-developer.properties
Try console.info. If that fails, use one of console.warn or console.error.
There may be a setting to remove this requirement from Firefox.
The situation occurs when Liferay 6.0 is running under Eclipse. Eclipse Liferay Plugin upgrade to 1.5 didn't help.
One can set fresh Liferay installation, run it under Eclipse and try console.log('hehe') in Firebug's immediate line -- it won't work.
But this bug does not occur in Liferay 6.1 with Tomcat 7.
Looks like it was some bug of Liferay 6.0. Log works in Liferay 6.1
$("#log") does not work in Liferay 5.2. The right syntax (in no-conflict mode) for Liferay is jQuery("#log") as they use multiple js frameworks.
Someone has found a way to disable Firebug-Lite completely by renaming the dirname
webapps/ROOT/html/js/firebug.. It seems to work but I also did what SO user "Yogesh Agrawal" suggested in his answer from Jul 4 at 5:27
See http://www.liferay.com/community/forums/-/message_boards/message/14202657
I'm using jQuery for my app and I'm getting this error in IE:
Line: 13
Char: 9
Error: Expected Identifier, string or number
Code: 0
..well, as you can see, the error isn't quite helpful. How do you fix those weird IE errors? Is there any tool or a list of error descriptions that tells you what to fix?
Thanks
I would suggest looking at line 13 of your JS file to find out where the error is.
FWIW, the "Expected Identifier, string or number" error often occurs when you have a trailing comma in a list or object declaration. Firefox doesn't mind this, but IE does.
Here's an article on debugging javascript in IE. IE8 comes with a built-in debugger.
The IE Script debugger is quite OK.
But try Mozilla's error console first. It has sane line numbering. Maybe the errors are identical.
Make sure you have Microsoft Office installed
In IE, go to Tools -> Internet Options -> Advanced tab
From there UNCHECK "Disable script debugging (Internet Explorer)"
Then when a script creates an error, you will be presented with a dialog box:
Click the YES button to sign your life over to microsoft to start the debugger.
This is a really tedious workflow (the default sound that happens when a script bug is encountered is really annoying) so I don't think its a good way to work, recommend firefox error console over it any day.
See also.