+ Reply to Thread
Results 1 to 5 of 5

Focus on Popup from Web Browser

  1. #1
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Focus on Popup from Web Browser

    The attached program opens a web browser, runs a report and clicks on the link to download the report. Clicking on this link brings up a pop-up box asking if you want to Open, Save or Cancel the downloaded report.

    When I get to this point manually, I can select the popup using the mouse or I can Press F6 and focus shifts to the Open button in the popup. I've attempted to emulate that in the code, but Sendkeys (which I would prefer not to use) doesn't seem to do the trick.

    How can I get focus on this window? I'll use sendkeys if that's what it takes.

    The URL is to a proprietary site. I don't know of a public site that acts the same way.

    Please Login or Register  to view this content.
    Attached Images Attached Images
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,882

    Re: Focus on Popup from Web Browser

    To my knowledge IE does not expose SaveAs menu to API. Only way to automate it is via sendkeys as far as I'm aware.

    However... if you can trace the request that's being sent to the server when download link is clicked...

    You may be able to automatically download it via Winhttp request.

    Below link may help.
    https://chandoo.org/forum/threads/ho...1/#post-220193
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Focus on Popup from Web Browser

    Sendkeys does not seem to be working. When the report is done running and the box pops up. I can click on F6 on the keyboard and it selects the first button in the popup box. However SendKeys "{F6}" doesn't do anything.

    I will look at the code suggested in the link, however I have to figure out what to fill in for "GET" and for getElementsById and getElementsByTagName.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Focus on Popup from Web Browser

    Hi !

    See via the inner webbrowser inspector tool in network section the request used …

    Another way is to use UIAutomationClient reference but seems to have issue under Windows 10.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Focus on Popup from Web Browser

    EUREKA! Sendkeys does work - I needed to add a timing loop to allow the popup box to appear.

    Marc, CK76 - thank you for your help and I will investigate. As I said, I am not a big fan of sendkeys since it is blind: it doesn't know where it is and it doesn't know what's happening.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. popup alert message during the worksheet open and continuous work on the sheet popup jump
    By shailkam2001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2014, 10:24 AM
  2. Returning focus to a browser tab that is already open?
    By XmisterIS in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-04-2014, 03:38 AM
  3. Launch Chrome Browser and Return Focus to Excel
    By Jagstrom in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2014, 11:38 PM
  4. Replies: 5
    Last Post: 04-08-2010, 01:01 AM
  5. Replies: 1
    Last Post: 07-22-2009, 09:45 AM
  6. Replies: 4
    Last Post: 05-18-2006, 11:25 PM
  7. Popup input-form on focus
    By Filips Benoit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2005, 08:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1