imacros - going back to TAB T=1 - imacros

Why doesn't this code work in Firefox? Why doesn't it execute the last command and go back to Tab 1 in the end?
iimPlay ("CODE: TAB T=1");
iimPlay ("CODE: TAB OPEN");
iimPlay ("CODE: TAB T=2");
iimPlay ("CODE: URL GOTO=https://vk.com");
iimPlay ("CODE: TAB T=1");
I expected that Tab 1 will open again.

Related

imacros display message to user if page or text not found

My current imacros code calls a URL from a datasource. Should the URL not load (scheduled downtime or wifi is broken) it must display the relevant message to the user. I am unable to get any information on how to display the message to the user when there is downtime or the wifi is down. Below is what I got so far:
VERSION BUILD=844 RECORDER=CR
SET !FILE_PROFILER YES
'Clear the Cache and history'
CLEAR
'Close any open tabs'
TAB CLOSEALLOTHERS
SET !ERRORIGNORE NO
SET !TIMEOUT_STEP 13
'Navigate to the EBU Online URL'
SET !DATASOURCE_COLUMNS 1
CMDLINE !DATASOURCE Apps.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO = {{!COL1}}
WAIT SECONDS=15
'There are no credentials for logging onto EBU Online'
Would appreciate any feedback, as I am new to imacros.
Windows 10
Chrome Version 61.0.3163.79 (Official Build) (64-bit)
If you want to display a message when there's no required text on the page, the following macro may help:
SET myText "imacros display message bla-bla-bla"
SET myScript "document.body.textContent.includes('{{myText}}') ? '' : alert('NO \"{{myText}}\" FOUND!');"
URL GOTO=javascript:{{myScript}}undefined;

iMacro dynamic attribute data extract

I have been trying to resolve this issue through different angles but not having any luck. Even tried using PHP to generate iMacro code to do this but really no luck.
Basically I am trying to use iMacro to pull some form data but the problem is on every page of the form I have 100 links to click but the issue is that I don't know how to tell iMacro to keep clicking the links in the table without specifying each link's name in the attribute:
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>China
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Mexico
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Japan
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Brazil
See how the ATTR=TXT field indicates the text of the element in the table? This means to get iMacro to click all the links I have to specify every element's text....This is a pain..Is there a way I can get iMacro to click on the links without specifying the text?
UPDATE: Here is the updated code that highlights but won't click the first link.
FRAME NAME=TargetContent
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:*
'New tab opened
TAB T=2
TAG POS={{!LOOP}} TYPE=DIV ATTR=ID:win2divUW_CO_JOBDTL_VW_UW_CO_JOB_DESCR EXTRACT=TXT
TAB CLOSE
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Documents\iMacro FILE=TestRun.csv
Here is what the HTML of the first link in table looks like, it is all generated by the server:
<a name="UW_CO_sd_HL$0" id="UW_CO_sd_HL$0" tabindex="72" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$0', 0, 0, 'Trip To Tokyo', false, true);" class="PSHYPERLINK">Tokyo</a>
The second HTML link in table looks like:
<a name="UW_CO_sd_HL$1" id="UW_CO_sd_HL$0" tabindex="78" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$1', 0, 0, 'Tonka Side', false, true);" class="PSHYPERLINK">Tonka</a>
UPDATE 2:
Here is the iMacro code after I do experimental recording and then x/y co-ordinate click. The code is from clicking the first couple of elements.
CLICK X=131 Y=473
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=153 Y=500
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=194 Y=541
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=152 Y=572
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=149 Y=608
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=169 Y=629
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=173 Y=666
TAB T=2
TAB CLOSE
TAB T=1
This code can be transformed to work better.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>*
For example if the links HTML looks like this
Trip to Somewhere
Then you can use these combinations of iMacros code to click the links.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=CLASS:link&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=ID:linkid&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=HREF:www.somelink.com/soomething_different_here/*&&TXT:*
Each of these combinations can work.

How to toggle visibility action bar tab navigation?

I use Action Bar Sherlock library.
In SherlockFragmentActivity, Make tabs and pager (Swipe + Tab)
actionBar.addTab(actionBar.newTab().setText("tab1").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("tab2").setTabListener(this));
actionBar.addTab(actionBar.newTab().setText("tab3").setTabListener(this));
When paging. I change tab.
When tab selected, I change page.
(These works fine.)
And make button to toggle visiblity.
actionBar.setNavigationMode(NAVIGATION_MODE_TABS); // this force tab index = 0
//or
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
But Setting navigation mode to NAVIGATION_MODE_TABS,
make tab index = 0 not current tab(pager) index
Try storing current tab index to an integer before you call actionBar.setNavigationMode(NAVIGATION_MODE_TABS);
int index=actionBar.getSelectedNavigationItem();
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
actionBar.setNavigationMode(NAVIGATION_MODE_DEFAULT);
actionBar.setSelectedNavigationItem(index);

Imacros won't click button?

I'm trying to build a script to post auto blog on Google Sites but the problem is that the button won't click. This is my screenshot: http://i.stack.imgur.com/W5mxq.png
Code Button
<div aria-label="New page" tabindex="0" style="-moz-user-select: none;" role="button" id="create-new-btn" class="goog-inline-block jfk-button jfk-button-standard jfk-button-collapse-left" aria-disabled="false"><span id="sites-collaborator-bar-create-new-page-icon" class="sites-camelot-icon"></span></div>
This is my code in Imacros
Code IMACROS
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=https://sites.google.com/site/testing/
TAG POS=1 TYPE=DIV ATTR=ID:create-new-btn
This is other code but in Javascript Imacros
Code JAVA
var macro;
macro = "CODE:";
macro += "TAB T=1" + "\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "SET !ERRORCONTINUE YES" + "\n";
macro += "SET !EXTRACT_TEST_POPUP NO" + "\n";
macro += "SET !TIMEOUT 500" + "\n";
macro += "URL GOTO=https://sites.google.com/site/testing/" + "\n";
macro += "TAG POS=1 TYPE=DIV ATTR=ID:create-new-btn" + "\n";
iimPlay(macro)
you can simply load create new page form instead of clicking on the button, since to click you'll have to emulate mouse hovering and use javascript.
Just load: https://sites.google.com/site/your-site/system/app/pages/createPage?source=/home
A possible work around is to use the CLICK command in imacros like so:
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=https://sites.google.com/site/testing/
CLICK X=1000 Y=10
where X is the distance from the top-left side of the browser to the middle of the button you want to click, and Y is the distance from the top of the browser to the middle of the button you want to click. You are able to measure these distances by doing a print-screen and going into a tool like paint and measuring the pixel distances (or any other tool you find more convenient).
You can try imacros for Firefox instead of Chrome, because in terms of clicking buttons imacros somehow perform better in Mozilla Firefox browser.
Maybe you should try clicking on the span inside that div. Perhaps this trigger the action.
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=https://sites.google.com/site/testing/
TAG POS=1 TYPE=SPAN ATTR=ID:sites-collaborator-bar-create-new-page-icon

Use a button to navigate to a different tab

My app has four tabs. The root view controller of the first tab (index zero) is where the log in page pops up as a modalviewcontroller, but a view controller in the fourth tab (index three) is where the log out button is. Is there a way to programmatically set it so that when the logout button is pushed the app transitions to the tab at index zero? I initially tried a push transition, but that made the root view controller of index zero instead show up as a view controller in index three.
If you want to programmatically change the tab, just call
[self.tabBarController setSelectedIndex:index];
In your case create the selector, which will be assigned to the logout button event.
- (IBAction) didClickLogoutButton:(id)sender {
// do some work to log out the user...
[self.tabBarController setSelectedIndex:0];
}
Hope this is what you meant.