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
Difference between revisions of "Browser Automation"
(was part of "Using iMacros") |
|||
Line 69: | Line 69: | ||
By default the settings are BUTTON=YES and CONTINUE=YES. These settings are active even without an ONERRORDIALOG in your macro. | By default the settings are BUTTON=YES and CONTINUE=YES. These settings are active even without an ONERRORDIALOG in your macro. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==Saving Web Sites == | ||
+ | |||
+ | (Related example macro: Demo-ArchivePage, Demo-SaveAs ) | ||
+ | |||
+ | [[Image:Savepage.gif|frame]] | ||
+ | |||
+ | iMacros automatically downloads and saves web pages for you. Use the Save Page button and select the format from the iMacros Save As dialog. iMacros will then insert a SAVEAS command in the macro, holding information about the format and the location where the file is saved. The default location is in the downloads\ directory of your iMacros installation. This command is very easily tweaked after the macro has been recorded to fit your needs. | ||
+ | |||
+ | You have different options as to which format you wish use to save the currently displayed web page. These options are | ||
+ | |||
+ | CPL | ||
+ | The complete web page is saved. The files and images are saved separately and stored in a folder. | ||
+ | |||
+ | MHT | ||
+ | The web page plus images are saved in a single file (Web Archive). | ||
+ | |||
+ | HTM | ||
+ | The web page source is saved with no images. If the page has frames all framed HTML pages are saved automatically. | ||
+ | |||
+ | TXT | ||
+ | Only the web page text is saved; all HTML tags are omitted. | ||
+ | |||
+ | EXTRACT | ||
+ | The value of the variable !EXTRACT is saved in CSV format. | ||
+ | |||
+ | BMP | ||
+ | A screenshot of the web page is saved. | ||
+ | |||
+ | ===Web Site Screenshot=== | ||
+ | |||
+ | [[Image:Web-page-screenshot-entire-screen.png|frame|iMacros takes screenshots of the entire web page, no matter what length]] | ||
+ | |||
+ | (Related example macro: Demo-TakeScreenshot ) | ||
+ | |||
+ | The iMacros Browser can automatically take screenshots of web pages. This includes the part "below the fold", i.e. iMacros takes the screenshot of the entire web page, no matter the length, even if it scrolls off-screen! | ||
+ | |||
+ | To take a web page screenshot insert a SAVEAS TYPE=BMP command into the macro like in this example (for the FOLDER and FILE settings see the documentation for the [[SAVEAS|SAVEAS command]]): | ||
+ | |||
+ | SAVEAS TYPE=BMP FOLDER=* FILE=My_Screenshot.bmp | ||
+ | |||
+ | The file format is the standard Windows Bitmap format (BMP). This file format can used with any image editor. Also, it can be compressed effectively with any ZIP compression tool or the Windows built-in "compress contents" option for folders. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===Save Website Elements=== | ||
+ | iMacros can intercept file downloads and even download pictures and other elements from the web site you are visiting. | ||
+ | |||
+ | ====Download Files==== | ||
+ | (Related example macro: Demo-Download) | ||
+ | |||
+ | [[Image:Dialog-download.png|thumb|150px|Save Dialog handled by iMacros]] | ||
+ | |||
+ | Whenever a file download is initiated, Internet Explorer will present you with the dialog shown. This dialog allows you to select want you would like to do with the file. If you choose to save it it will also ask you for the file name and location. | ||
+ | |||
+ | Downloads are controlled by the ONDOWNLOAD command. It has two parameters that control the file name and the folder in which to save the file. It must appear before the macro command that starts the download. | ||
+ | |||
+ | Note: The general web page timeout also applies to downloads. So make sure that the timeout value is long enough to cover the complete download time. If needed you can also increase the timeout value manually inside the macro with the SET !TIMEOUT command. Alternatively, you can add a WAIT SECONDS=#DOWNLOADCOMPLETE# command. | ||
+ | |||
+ | ====Save Item==== | ||
+ | |||
+ | [[Image:Saveitem.gif|frame|In iMacros browser]] [[Image:Saveitemas.gif|frame|In IE plug-in]] | ||
+ | |||
+ | (Related example macro: Demo-ImageDownload ) | ||
+ | |||
+ | To download an image (or any other specific web page element) switch to recording mode, navigate to the page and press Save Item in the iMacros Browser or Save Item As in the Internet Explorer Plug-In. | ||
+ | |||
+ | The item download preview opens in the tab on the left. Next, select the image or item in the web browser window. The selection is then displayed in the preview section. If you like the selection press ok. The item download manager automatically adds a TAG line to your macro, e.g.: | ||
+ | |||
+ | TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/logo.jpg CONTENT=EVENT:SAVEITEM | ||
+ | |||
+ | You can also create download tag lines manually. During recording simply click on the wanted item and add "CONTENT=EVENT:SAVEITEM" to the generated TAG line in an editor of your choice. | ||
+ | |||
+ | The downloaded files are copied to the iMacros download directory (usually C:\Program Files\iMacros\downloads\). The items are taken directly from the web browser that displayed them; to save time and bandwidth they are not downloaded again. The naming convention for downloaded images is the same as for downloaded files, i.e. they consist of the original file name and a date and time tag. This also means you can use the ONDOWNLOAD command to specify your name for the downloaded image. | ||
+ | |||
+ | You can also download images using SAVEPICTUREAS. The command is named after the corresponding function in the Internet Explorer menu: "Save Picture as". You can right-click on any web page element to see if the web page element supports this feature; if it does iMacros can handle it automatically for you. To create such a command click on the element you would like to save during record and add "CONTENT=EVENT:#SAVEPICTUREAS" manually to the generated TAG command. To control the location and name of the downloaded file use the ONDOWNLOAD command. | ||
+ | |||
+ | ====Save Target As ==== | ||
+ | (Related example macro: Demo-SaveTargetAs) | ||
+ | |||
+ | To download any kind of web content such as .WVM or .AVI videos, sound files such as .MP3, or documents such as .PDF, first click on the link that connects to the item. In the case of a .PDF file such a link is typically called "Open document" or for a video file "Show video". iMacros records a TAG command: | ||
+ | |||
+ | TAG POS=1 TYPE=B ATTR=TXT:Open<SP>PDF<SP>Document | ||
+ | |||
+ | This would simulate a mouse click on the link. This is not what we want, we need a command similar to the right-click command "Save Target As" in Internet Explorer. This can be archieved by editing the macro and adding "CONTENT=EVENT:SAVETARGETAS" to the recorded normal TAG command. You will then have: | ||
+ | |||
+ | TAG POS=1 TYPE=B ATTR=TXT:Open<SP>PDF<SP>Document CONTENT=EVENT:SAVETARGETAS | ||
+ | |||
+ | The files downloaded in this way are copied to the iMacros download directory by default. You can use the ONDOWNLOAD command to specify the name and location for the downloaded image. | ||
+ | |||
+ | ====Save Picture As==== | ||
+ | (Related example macro: Demo-ImageDownload) | ||
+ | |||
+ | This command is similar to SAVEITEM, which is the default command for image downloading. However, unlike SAVEITEM it does not access the image via the HTML of the website but directly by simulating the Internet Explorer "Save Picture As" command. This can be an advantage on complex websites or websites where images are constructed "on the fly". | ||
+ | |||
+ | To use SAVEPICTUREAS you need to manually edit a recorded macro. Click on the element you wish to download and iMacros will produce a command like | ||
+ | |||
+ | TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/ | ||
+ | |||
+ | This would simulate a mouse click on the link. Since this is not what we want we need to edit the macro and add "CONTENT=EVENT:SAVETARGETAS" to the recorded TAG command. You will then have | ||
+ | |||
+ | TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/ CONTENT=EVENT:SAVEPICTUREAS | ||
+ | |||
+ | The files downloaded in this way are copied to the iMacros download directory by default. You can use the ONDOWNLOAD command to specify the name and location for the downloaded image. |
Revision as of 08:40, 26 April 2007
Dialog Manager
The Dialog Manager allows you to manage all those pesky dialogs that appear with Internet Explorer from time to time. Because the iMacros Browser emulates Internet Explorer the same dialogs appear in the iMacros Browser too.
Login
iMacros fills all login dialogs for you using the ONLOGIN command. The password is stored with the method you selected on the Security tab of the Options dialog. More details about the different password storage options can be found here.
Javascript
(Related example macro: Demo-OnJavascriptDialog )
iMacros handles all Javascript dialog boxes for you using the ONDIALOG command. You can extract the text of a dialog by adding SET !EXTRACTDIALOG YES to your macro.
Tip: On some pages a new page loads once a button on the dialog is clicked. If you want iMacros to wait for this page to load before continuing please add "WAIT SECONDS=#DOWNLOADCOMPLETE#" after the TAG statement that triggers the dialog box.
Web Page Dialogs
(Related example macro: Demo-OnWebPageDialog)
Web page dialogs are similar to Javascript dialogs, except they display HTML content. iMacros can control them using the ONWEBPAGEDIALOG command. Since web page dialogs can contain any number of buttons or boxes you can automate them by sending a specific list of keyboard commands to them. For example "KEYS=Hello{ENTER}{CLOSE}" will enter the word "Hello" on the dialog, press ENTER key and then close the dialog.
During replay "ONWEBPAGEDIALOG KEYS={WAIT<sp>2}{CLOSE}" is active by default to close unwanted ad dialogs.
Note: Web page dialogs are not normal HTML browser windows. Therefore they do not open in a separate tab, but pop up in front of the current window.
(Related example macro: Demo-Print)
The dialog manager works with the print dialog. For more details please see the PRINT command.
Security Dialogs
Security dialogs can occur on many secure web sites. The iMacros Dialog Manager automatically clicks the security dialog boxes so your macros are not interrupted. This is done using the ONSECURITYDIALOG command.
By default the settings are BUTTON=YES and CONTINUE=YES. These settings are active even without an ONSECURITYDIALOG command in your macro.
Certificates
Some secure web pages ask you to select a client side certificate. The dialog manager can do this for you using the ONCERTIFICATEDIALOG command.
Page Errors
(Related example macro: Demo-OnError)
Page script errors can occur on many web sites for a variety of reasons. The iMacros Dialog Manager automatically clicks the Internet Explorer error dialog boxes so your macros are not interrupted by script errors! This is done using the ONERRORDIALOG command.
By default the settings are BUTTON=YES and CONTINUE=YES. These settings are active even without an ONERRORDIALOG in your macro.
Saving Web Sites
(Related example macro: Demo-ArchivePage, Demo-SaveAs )
iMacros automatically downloads and saves web pages for you. Use the Save Page button and select the format from the iMacros Save As dialog. iMacros will then insert a SAVEAS command in the macro, holding information about the format and the location where the file is saved. The default location is in the downloads\ directory of your iMacros installation. This command is very easily tweaked after the macro has been recorded to fit your needs.
You have different options as to which format you wish use to save the currently displayed web page. These options are
CPL
The complete web page is saved. The files and images are saved separately and stored in a folder.
MHT
The web page plus images are saved in a single file (Web Archive).
HTM
The web page source is saved with no images. If the page has frames all framed HTML pages are saved automatically.
TXT
Only the web page text is saved; all HTML tags are omitted.
EXTRACT
The value of the variable !EXTRACT is saved in CSV format.
BMP
A screenshot of the web page is saved.
Web Site Screenshot
(Related example macro: Demo-TakeScreenshot )
The iMacros Browser can automatically take screenshots of web pages. This includes the part "below the fold", i.e. iMacros takes the screenshot of the entire web page, no matter the length, even if it scrolls off-screen!
To take a web page screenshot insert a SAVEAS TYPE=BMP command into the macro like in this example (for the FOLDER and FILE settings see the documentation for the SAVEAS command):
SAVEAS TYPE=BMP FOLDER=* FILE=My_Screenshot.bmp
The file format is the standard Windows Bitmap format (BMP). This file format can used with any image editor. Also, it can be compressed effectively with any ZIP compression tool or the Windows built-in "compress contents" option for folders.
Save Website Elements
iMacros can intercept file downloads and even download pictures and other elements from the web site you are visiting.
Download Files
(Related example macro: Demo-Download)
Whenever a file download is initiated, Internet Explorer will present you with the dialog shown. This dialog allows you to select want you would like to do with the file. If you choose to save it it will also ask you for the file name and location.
Downloads are controlled by the ONDOWNLOAD command. It has two parameters that control the file name and the folder in which to save the file. It must appear before the macro command that starts the download.
Note: The general web page timeout also applies to downloads. So make sure that the timeout value is long enough to cover the complete download time. If needed you can also increase the timeout value manually inside the macro with the SET !TIMEOUT command. Alternatively, you can add a WAIT SECONDS=#DOWNLOADCOMPLETE# command.
Save Item
(Related example macro: Demo-ImageDownload )
To download an image (or any other specific web page element) switch to recording mode, navigate to the page and press Save Item in the iMacros Browser or Save Item As in the Internet Explorer Plug-In.
The item download preview opens in the tab on the left. Next, select the image or item in the web browser window. The selection is then displayed in the preview section. If you like the selection press ok. The item download manager automatically adds a TAG line to your macro, e.g.:
TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/logo.jpg CONTENT=EVENT:SAVEITEM
You can also create download tag lines manually. During recording simply click on the wanted item and add "CONTENT=EVENT:SAVEITEM" to the generated TAG line in an editor of your choice.
The downloaded files are copied to the iMacros download directory (usually C:\Program Files\iMacros\downloads\). The items are taken directly from the web browser that displayed them; to save time and bandwidth they are not downloaded again. The naming convention for downloaded images is the same as for downloaded files, i.e. they consist of the original file name and a date and time tag. This also means you can use the ONDOWNLOAD command to specify your name for the downloaded image.
You can also download images using SAVEPICTUREAS. The command is named after the corresponding function in the Internet Explorer menu: "Save Picture as". You can right-click on any web page element to see if the web page element supports this feature; if it does iMacros can handle it automatically for you. To create such a command click on the element you would like to save during record and add "CONTENT=EVENT:#SAVEPICTUREAS" manually to the generated TAG command. To control the location and name of the downloaded file use the ONDOWNLOAD command.
Save Target As
(Related example macro: Demo-SaveTargetAs)
To download any kind of web content such as .WVM or .AVI videos, sound files such as .MP3, or documents such as .PDF, first click on the link that connects to the item. In the case of a .PDF file such a link is typically called "Open document" or for a video file "Show video". iMacros records a TAG command:
TAG POS=1 TYPE=B ATTR=TXT:Open<SP>PDF<SP>Document
This would simulate a mouse click on the link. This is not what we want, we need a command similar to the right-click command "Save Target As" in Internet Explorer. This can be archieved by editing the macro and adding "CONTENT=EVENT:SAVETARGETAS" to the recorded normal TAG command. You will then have:
TAG POS=1 TYPE=B ATTR=TXT:Open<SP>PDF<SP>Document CONTENT=EVENT:SAVETARGETAS
The files downloaded in this way are copied to the iMacros download directory by default. You can use the ONDOWNLOAD command to specify the name and location for the downloaded image.
Save Picture As
(Related example macro: Demo-ImageDownload)
This command is similar to SAVEITEM, which is the default command for image downloading. However, unlike SAVEITEM it does not access the image via the HTML of the website but directly by simulating the Internet Explorer "Save Picture As" command. This can be an advantage on complex websites or websites where images are constructed "on the fly".
To use SAVEPICTUREAS you need to manually edit a recorded macro. Click on the element you wish to download and iMacros will produce a command like
TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/
This would simulate a mouse click on the link. Since this is not what we want we need to edit the macro and add "CONTENT=EVENT:SAVETARGETAS" to the recorded TAG command. You will then have
TAG POS=1 TYPE=IMG ATTR=HREF:http://www.iopus.com/ CONTENT=EVENT:SAVEPICTUREAS
The files downloaded in this way are copied to the iMacros download directory by default. You can use the ONDOWNLOAD command to specify the name and location for the downloaded image.