The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Editor
The iMacros Editor (iMacrosEditor.exe) was designed specially to edit iMacros macros, but it can be used to edit any text file, including batch files, vbs and javascripts, XML files, etc. The iMacros Editor is able to recognize these languages and highlight their syntax accordingly. The iMacros Editor is associated to the *.iim files so by right clicking on any .iim file and choosing Edit, the macro is open in the iMacros Editor. This is also the case from any "edit action" in iMacros Browser or iMacros for IE.
The iMacros Editor offers more than highlighting iMacros syntax. With it editing iMacros macros is much easier and even testing parts of the macro being edited can be done directly from the editor. The editor has also the ability to export recorded macros to Selenium WebDriver Java code.
Export Macro
Once a macro is open in the editor, you can export it completely or partially to be played either by iMacros iMacros Scripting API, or to Selenium WebDriver.
Export to Selenium WebDriver Java code
Now you can profit from iMacros powerful recorder and export the recorded macro to Selenium WebDriver Java code (QA automation) using iMacros Editor. Use any iMacros (for Chrome, Firefox, Internet Explorer, or iMacros Browser) to record elements on a webpage and export the commands to Java Selenium code directly from the iMacros Editor.
Whether you decide to export the complete macro or only a selection of it, when you choose the Selenium WebDriver option in the Export menu, a new file will be created with a complete snippet of code like the one below, ready to be inserted in you project.
The easiest way to export is to use the "J" button from the toolbar.
// WebDriver java snippet for Selenium generated by iMacros Editor package Imacros; import java.util.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.*; import org.openqa.selenium.chrome.ChromeDriver; public class FromiMacros { public static void main(String[] args) { // Please set the correct path to your Chromedriver.exe file System.setProperty("webdriver.chrome.driver", "\\Chromedriver.exe"); WebDriver driver = new ChromeDriver(); try { List<WebElement> frames; Set<String> tabs; WebElement element; // VERSION BUILD=11.5.497.9113 tabs = driver.getWindowHandles(); driver.switchTo().window(tabs.toArray(new String[0])[0]); driver.get("http://demo.imacros.net/Automate/TestForm1"); // 'Macro that makes use of Css Selector while recording element = driver.findElement(By.cssSelector("#name")); element.clear(); element.sendKeys("iMacros user"); // 'Drop down element = driver.findElement(By.cssSelector("#food")); element.clear(); element.sendKeys("%Bread and Butter"); element = driver.findElement(By.cssSelector("#drink")); element.clear(); element.sendKeys("%Coke"); // 'Radio button element = driver.findElement(By.cssSelector("#large")); element.click(); element = driver.findElement(By.cssSelector("#dessert")); element.clear(); element.sendKeys("%cranberry"); element = driver.findElement(By.cssSelector("#demo>FIELDSET>OL>LI:nth-of-type(6)>INPUT")); element.click(); // SET !ENCRYPTION NO element = driver.findElement(By.cssSelector("#demo>FIELDSET>OL>LI:nth-of-type(6)>INPUT:nth-of-type(2)")); element.clear(); element.sendKeys("trial"); element = driver.findElement(By.cssSelector("#demo>FIELDSET>OL>LI:nth-of-type(7)>TEXTAREA")); element.clear(); element.sendKeys("Order placed"); // ' element = driver.findElement(By.cssSelector("#demo>FIELDSET:nth-of-type(2)>BUTTON")); element.click(); } catch (Exception e) { System.out.println(e); } finally { driver.close(); driver.quit(); } } }
However, there are times when you only need to append a few lines to your class or method. In this case, the Export to Clipboard menu item in the Edit menu will put only the needed lines of code in the clipboard which you can then paste into your file.
In both cased, the generated code works best when the macro is recorded in the same browser which is going to be used by the WebDriver.
Export to Scripting Interface code
The iMacros Editor can also generate a snippet of C#, Javascript, or VBScript code which embeds the current selected macro code and uses iMacros Scripting API. The example below shows the C# generated code from a partial selection of FillForm.iim.
// C# snippet generated by iMacros Editor.
// See http://wiki.imacros.net/Web_Scripting for details on how to use the iMacros Scripting Interface.
// iMacros.AppClass iim = new iMacros.AppClass();
// iMacros.Status status = iim.iimOpen("", true, timeout);
StringBuilder macro = new StringBuilder();
macro.AppendLine(@"URL GOTO=http://demo.imacros.net/Automate/TestForm1");
macro.AppendLine(@"'We use quotation marks for a content with spaces");
macro.AppendLine(@"TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:name CONTENT=""iMacros User""");
macro.AppendLine(@"'Selecting a drop down");
macro.AppendLine(@"TAG POS=1 TYPE=SELECT ATTR=NAME:food CONTENT=%French<SP>Fries");
macro.AppendLine(@"TAG POS=1 TYPE=SELECT ATTR=NAME:drink CONTENT=%Coke");
macro.AppendLine(@"'Selecting a radio button");
macro.AppendLine(@"TAG POS=2 TYPE=INPUT:RADIO ATTR=NAME:drinksize");
string macroCode = macro.ToString();
// status = iim.iimPlayCode(macroCode, timeout);
Uncomment the code lines which creates the iMacros object
iMacros.AppClass iim = new iMacros.AppClass();
iMacros.Status status = iim.iimOpen("", true, timeout);
and call the scripting interface methods
status = iim.iimPlayCode(macroCode, timeout);
to have a complete working program in the chosen language.
See iimOpen for more details on how to change the browser and browser options in the generated code.
Play Macro Selection
In the Play menu you find not only the option to play the complete macro open in the editor, but also fragments of it. The editor sends the macro or macro lines to the running iMacros Browser (or iMacros Sidebar for IE) to be played via iMacros Scripting API.
Please notice these few remarks about the play feature:
- If no text is selected on the editor, the line currently under the cursor is played.
- The editor sends complete lines to iMacros, even if the selection contains only a piece of a line.
- Play from Here plays all lines from the cursor to the end of the macro.
- Choose the submenu Play in... another browser like IE, Fx, or Cr where the macro or macro fragment will be played.
- Play in IE is checked by default if the editor was started from iMacros for IE, via one of the "edit actions" in the iMacros sidebar.
- The editor plays the macro in the currently open browser. If an open browser is not found, a new browser window is created to play the macro.
- After playing the macro, the browser window remains open.
The editor uses the iMacros Scripting API to play the macro. iimOpen (<browser>, false) is called to connect to the existing iMacros browser and iimPlayCode is used to send the code from the editor to iMacros. Since only iMacros Enterprise Edition contains the Scripting API, this feature is disabled in other editions.
Other features
For a comfortable editing of macros containing IMAGESEARCH and IMAGECLICK commands, the editor shows thumbnails of the images referenced in these commands. When you hover the mouse over the name of an image file, it pops-up a small thumbnail preview of that image.
You can insert pre-defined command and variable templates directly into your macro using the Insert menu. Adjust the parameters after inserting the template. You find additionally in this menu the password encryption/decryption tool, which recognizes an encrypted password and can decrypt it, given the master key is entered. The password tool can also be invoked using the shortcut key combinations Ctrl+E (for encryption) and Ctrl+D (for decryption).