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 "URL"
(6 intermediate revisions by 2 users not shown) | |||
Line 18: | Line 18: | ||
' open a webpage in the first tab | ' open a webpage in the first tab | ||
− | URL GOTO=http:// | + | URL GOTO=http://imacros.net |
' open a new tab | ' open a new tab | ||
TAB OPEN | TAB OPEN | ||
Line 25: | Line 25: | ||
' load another page | ' load another page | ||
URL GOTO=http://www.google.com | URL GOTO=http://www.google.com | ||
+ | |||
+ | === Using Javascript === | ||
The URL can also call Javascript functions that are either defined in this line or are embedded in the page (V6.22 and later): | The URL can also call Javascript functions that are either defined in this line or are embedded in the page (V6.22 and later): | ||
Line 30: | Line 32: | ||
URL GOTO=javascript:alert("TEST"); | URL GOTO=javascript:alert("TEST"); | ||
− | URL GOTO=http:// | + | URL GOTO=http://imacros.net |
URL GOTO=javascript:openDemo('shared/flash/imacros1',820,650); | URL GOTO=javascript:openDemo('shared/flash/imacros1',820,650); | ||
TAB T=2 | TAB T=2 | ||
− | Open a local file | + | Spaces in the Javascript code need to be replaced with <SP>. For example: |
+ | |||
+ | if(frames.length<1){alert('This page has'+document.links.length+' links.');}else{alert('The page has frames!');} | ||
+ | |||
+ | becomes: | ||
+ | |||
+ | URL GOTO=javascript:if(frames.length<1){alert('This<SP>page<SP>has<SP>'+document.links.length+'<SP>links.');}else{alert('The<SP>page<SP>has<SP>frames!');} | ||
+ | |||
+ | The URL GOTO command by default outputs the result of the evaluated Javascript expression on a new page in the current tab. If you want to manipulate an element on the page and don't want the result to be processed by the URL GOTO command, you need to wrap it in some other call or expression that does not evaluate to any value. | ||
+ | |||
+ | For example, to change the value of the Name field on the demo Fill Form page, you can wrap the call in console.log() as follows: | ||
+ | |||
+ | URL GOTO=http://demo.imacros.net/Automate/TestForm1 | ||
+ | URL GOTO=javascript:console.log(document.getElementById("name").value='Test'); | ||
+ | |||
+ | Example to scroll the web page: | ||
+ | |||
+ | URL GOTO=javascript:window.scrollBy(0,20000) | ||
+ | |||
+ | === Open a local file === | ||
URL GOTO=file:///D:/test/image.png | URL GOTO=file:///D:/test/image.png | ||
URL GOTO=file:///D:/test/report.html | URL GOTO=file:///D:/test/report.html | ||
Line 44: | Line 65: | ||
=== See Also === | === See Also === | ||
− | [[TAB]], [[TAG]], [[BACK]] | + | [[TAB]], [[TAG]], [[BACK]], [[EVAL]] |
Revision as of 08:22, 28 September 2017
Navigates to a URL in the currently active tab.
Syntax
URL GOTO=some_URL
Note: iMacros automatically inserts a URL GOTO command at the start of every recording. However, the command is not required. It can be removed. Removing this command is useful if you want the macro to continue where another macro (or a human user) left off. Without URL GOTO, iMacros continues at the exactly same position, without reloading the page.
Parameters
- GOTO
- Specifies the URL to go to.
Examples
If you want to open a second website, use the following code:
' open a webpage in the first tab URL GOTO=http://imacros.net ' open a new tab TAB OPEN ' get new tab to foreground TAB T=2 ' load another page URL GOTO=http://www.google.com
Using Javascript
The URL can also call Javascript functions that are either defined in this line or are embedded in the page (V6.22 and later):
URL GOTO=javascript:alert("TEST");
URL GOTO=http://imacros.net URL GOTO=javascript:openDemo('shared/flash/imacros1',820,650); TAB T=2
Spaces in the Javascript code need to be replaced with <SP>. For example:
if(frames.length<1){alert('This page has'+document.links.length+' links.');}else{alert('The page has frames!');}
becomes:
URL GOTO=javascript:if(frames.length<1){alert('This<SP>page<SP>has<SP>'+document.links.length+'<SP>links.');}else{alert('The<SP>page<SP>has<SP>frames!');}
The URL GOTO command by default outputs the result of the evaluated Javascript expression on a new page in the current tab. If you want to manipulate an element on the page and don't want the result to be processed by the URL GOTO command, you need to wrap it in some other call or expression that does not evaluate to any value.
For example, to change the value of the Name field on the demo Fill Form page, you can wrap the call in console.log() as follows:
URL GOTO=http://demo.imacros.net/Automate/TestForm1 URL GOTO=javascript:console.log(document.getElementById("name").value='Test');
Example to scroll the web page:
URL GOTO=javascript:window.scrollBy(0,20000)
Open a local file
URL GOTO=file:///D:/test/image.png URL GOTO=file:///D:/test/report.html
Related Forum Posts
- Click a submit ("Enter") button with URL GOTO=javascript:window.document.form.submit()
- How to use URL GOTO to call Javascript functions