Link opens in new tab cannot switch focus to Tab 2

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
matthlafaurie1
Posts: 1
Joined: Thu May 19, 2016 9:16 am

Link opens in new tab cannot switch focus to Tab 2

Post by matthlafaurie1 » Thu May 19, 2016 10:45 am

Hello-
I'm new to the forum but have been using imacros successfully for its screen scrapping capabilities.
I'm creating a topic here because I'm REALLY stuck! I've been looking at all the topics and nothing works for me.
Thank you in advance for looking into this.

Process: I need to recreate a process to automate it on a weekly basis.

Problem: My macro works correctly until I have to click a link (javascript) that opens in a new tab.
Then I try to shift the focus to that tab but nothing happens.
I even tried to bypass clicking the link and open a new tab and go to the URL, but it open the tab and open the URL in Tab 1.

Code: Select all

VERSION BUILD=11.1.495.5175
TAB T=1
TAB CLOSEALLOTHERS
SET !TIMEOUT_STEP 10
SET !TIMEOUT_PAGE 60
SET !ERRORIGNORE YES 

URL GOTO=https://myurl.com
TAG POS=1 TYPE=SELECT ATTR=NAME:OptionSetId CONTENT=%9395
TAG POS=1 TYPE=SELECT ATTR=NAME:SearchSelection CONTENT=%SEARCH~P~Prompted

TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:StartDate CONTENT=16/06/16
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:Duration CONTENT=120
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:ShopStartDate CONTENT=09/05/16
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:ShopEndDate CONTENT=16/05/16

TAG POS=1 TYPE=IMG ATTR=ID:img_sreServiceOptions_RunProcess
'New tab opened
'This where it stops working as it does not switch its focus to TAB 2
TAB T=2


TAG POS=1 TYPE=SELECT ATTR=NAME:!SRC!NPO_RESRC_CAL_PARAM!RESRC_ID!L!AWE_SEARCH!P!0 CONTENT=%0013
TAG POS=2 TYPE=SPAN ATTR=TXT:Done
Here is an alternative that I explained by bypassing the link "clicking" and trying to open a new tab and go to the URL.

Code: Select all

TAB OPEN
TAB T=2
URL GOTO=https://myurl.com/ProcessLaunch

TAG POS=1 TYPE=SELECT ATTR=NAME:!SRC!NPO_RESRC_CAL_PARAM!RESRC_ID!L!AWE_SEARCH!P!0 CONTENT=%0013
TAG POS=2 TYPE=SPAN ATTR=TXT:Done
But this alternative ending up opening a new tab and replace the URL of TAB1

This does not work as both windows need to stay open in order for the process to work.

I use IE11 in compability mode because my web application is only developed for IE9.

Thank you so much for looking into this.

Matthieu
IrishMacro
Posts: 135
Joined: Wed Nov 03, 2010 12:27 pm

Re: Link opens in new tab cannot switch focus to Tab 2

Post by IrishMacro » Fri May 20, 2016 2:04 pm

I assume you have the free plugin of imacros for your ie11?

I just tested it on my own machine and IE switched focus to the new tab

Shorten your code to
Go to page
Click a link that opens in new tab
Check focus is switched to new tab.

It's also possible it's the browser itself that may be acting up but try the above first.
Firefox free plugin, last version
Win7
J.M.
Posts: 2
Joined: Tue Aug 16, 2016 4:45 pm

Re: Link opens in new tab cannot switch focus to Tab 2

Post by J.M. » Tue Aug 16, 2016 5:08 pm

Any solution here?

I am experiencing a problem that is possibly related or similar, where a second tab is not responding after open (although I can switch focus). I've found some posts (such as http://forum.imacros.net/viewtopic.php? ... tab#p70180) but none seem to have reached any resolution.

Thanks!
Post Reply