Download File Via JavaScript Calls From Website

Hello,
I am currently trying to create a program in c# that will download the file "PracticeProfiles.xls" from this website:
http://fingertips.phe.org.uk/profile/general-practice/data
I need to somehow on navigation to this site pass the javascript calls "showExport();exportData();", which will start the download.
Any help would be greatly appreciated.
Many Thanks

The link has a method which apparently works, however I had to modify a few things to make it compile:
public void DownloadIEFile(Browser browser)
HwndSource source;
source = HwndSource.FromHwnd(WatiN.Core.Native.Windows.NativeMethods.GetWindow(browser.hWnd, 5));
Window windowMain = source.RootVisual as Window;
System.Windows.Automation.TreeWalker trw = new System.Windows.Automation.TreeWalker(System.Windows.Automation.Condition.TrueCondition);
System.Windows.Automation.AutomationElement mainWindow = trw.GetParent(System.Windows.Automation.AutomationElement.FromHandle(browser.hWnd));
source = HwndSource.FromHwnd(WatiN.Core.Native.Windows.NativeMethods.GetWindow(new WindowInteropHelper(windowMain).Handle, 5));
Window windowDialog = source.RootVisual as Window;
// if doesn't work try to increase sleep interval or write your own waitUntill method
Thread.Sleep(1000);
windowDialog.Activate();
System.Windows.Automation.AutomationElementCollection amc = System.Windows.Automation.AutomationElement.FromHandle(new WindowInteropHelper(windowDialog).Handle).FindAll(System.Windows.Automation.TreeScope.Children, System.Windows.Automation.Condition.TrueCondition);
foreach (System.Windows.Automation.AutomationElement element in amc)
// You can use "Save ", "Open", ''Cancel', or "Close" to find necessary button Or write your own enum
if (element.Current.Name.Equals("Save"))
// if doesn't work try to increase sleep interval or write your own waitUntil method
// WaitUntilButtonExsist(element,100);
Thread.Sleep(1000);
System.Windows.Automation.AutomationPattern[] pats = element.GetSupportedPatterns();
// replace this foreach if you need 'Save as' with code bellow
foreach (System.Windows.Automation.AutomationPattern pat in pats)
// '10000' button click event id
if (pat.Id == 10000)
System.Windows.Automation.InvokePattern click = (System.Windows.Automation.InvokePattern)element.GetCurrentPattern(pat);
click.Invoke();
However I am getting null when I try to get the hwnd source, can't see why?
Any Suggestions?
Many Thanks

Similar Messages

  • The audo files do not play from websites instead ask for download. This has occured from the time I have updated Firefox 4 to Firefox 5. Why? And how can i play audio files?

    The audo files do not play from websites instead ask for download. This has occured from the time I have updated Firefox 4 to Firefox 5. Why? And how can i play audio files from websites?

    You have a <b>general.useragent.override</b> pref that identifies you as Firefox/3.5.7
    *Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)
    See:
    *https://support.mozilla.com/kb/Websites+or+add-ons+incorrectly+report+incompatible+browser
    *http://kb.mozillazine.org/Resetting_your_useragent_string_to_its_compiled-in_default

  • Understanding wsdl file to be called from Partner link

    Hii All,
    I am trying to understand the wsdl file. This file is being called from a partner link. I have understood most of the part of it but could not understand the following:
    <jca:operation
    LogicalDirectory="inputTriggerDir"
    ActivationSpec="oracle.tip.adapter.file.inbound.FileActivationSpec"
    IncludeFiles=".*\.trg"
    PollingFrequency="10"
    MinimumAge="0"
    DeleteFile="true"
    OpaqueSchema="false" >
    </jca:operation>
    Would appreciate if you could please help to make me understand this part of wsdl file. I have noticed that if i change the value of LogicalDirectory parameter then the build does not deploy successfully. Somehow it is linked with the bpel.xml...Please suggest me how?
    Appreciate your help..
    Thanks,
    Regards,
    AS

    This is the operation that will be performed when a file is read.
    LogicalDirectory = This is the property you have specified to identify the directory to poll. This is best practice, if you do this then you need to specify a name in the bpel.xml file. This also means you can change the directory on the fly within the BPEL console. If you right-click on the recieve for the partner link there is a property tab add the property inputTriggerDir and give the value of the directory on the server.
    ActivationSpec = This is just a pointer to the java code, this is defaulted and should not be changed.
    IncludesFiles = in your case you are looking for files with the extension of .trg
    PollingFrequency = in your case 10 second interval
    MinimumAge = This allows you to put a buffer so if a file takes some time to load you can put a wait until you get the full file.
    DeleteFile = Once read it will delete
    OpaqueSchema = If true means that you have specified no schema and is read in as binary. This is used for pass through, what you read in is what comes out the other side. Manly used for pdf and images.
    cheers
    James

  • Upload and Download file through RFC called by java

    We are trying to download/upload file through rfc function called by java(JCO),In the rfc function,we use WS_DOWNLOAD,but it does not work.
    Any one know about this,Please help ,thanks very much.
    Message was edited by: gw gw

    Hi gw,
    This question looks a little confusing to me.
    WS_DOWNLOAD is used to download files from SAP to the presentation server (your PC).  It will not work through RFC.
    BUT, also if you want to access a function module via RFC is must be RFC enabled (as Anand pointed out).
    AND WS_DOWNLOAD uses a PUSH approach.  It pushes a file to the PC from ABAP.  So even if the two points above weren't a problem it still would not be suitable for what you are doing.
    Perhaps you could explain a little what you are trying to achieve.
    Cheers,
    Brad

  • Javascript call from Flash in modal dialog window

    Hi.
    As I see it's impossible to call Javascript function from
    flash in modal dialog (opened with showModalDialog), neither with
    getURL nor with ExternalInterface.call.
    The only solution I found (in my case it's enough, I only
    need to refresh some DIV content in the page from flash) is to
    catch error in the modal dialog (Javascript window.onerror) and
    then do some operations.
    I'm intereseted: is this for security reason on Win XP SP2? I
    didn't found any solution, but is there any?

    Hi Gary,
    Actually I'm not very sure that whether it is the VS issue if it still has this issue in a new Environment.
    To make sure that it is not the VS setup file issue, one idea is that you could re-download your VS2013 Pre version here:
    http://www.visualstudio.com/downloads/download-visual-studio-vs
    And then re-install it again. Test the result. Hope that it is not the VS setup file issue.
    If still no help, really sorry for that I couldn't repro this issue in my side. But
    you can submit this feedback to Microsoft Connect feedback portal:
    http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx,Microsoft
    engineers will evaluate them seriously. You could share this project in your report, the product team members would troubleshoot and repro this issue.
    You will get email notification for update in your connect report.
    If you submit it, please share us the link here, so we could get the latest information from the product team members.
    Sincerely,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Download file via Browser window

    Hello,
    I have a question about downloading a file. How can i Download the file via the browser ? I did get it working to download with flex but also get
    "Error: Error #2176" this error with flash 10 which is not good :-/
    Is there a way to download a file via the browser . i.e : with firefox download window , etc.
    I have seen weborb doing it while i was downloading the weborb application, and i wanted to know if anyone has any idea or sample on how to get this done.
    Help is appreciated .
    Thanks.

    You could write a Javascript function in the HTML page that accepts a URL string as its parameter. This function get then open a new window with this url. You could invoke this function it via the ExternalInterface API in Flex. I believe that would invoke the Firefox Download Manager.

  • Pdf extension changes to .dat when send a file via e-mail from adobe acrobat 9

    to convert a file from microsoft word 2007 to PDF and send as an attachment via e-mail from adobe 9, the file is received with the extension changed to. dat, so recipients can not open it.
    Can anyone help me with this.

    What is the OS of the sending computer?
    What mail client?
    I receive plenty of files on my PC as .dat files, which come from Mac user(s), rename the extension to what I think they ought to be and have no further problem. (I cannot change the senders email settings where the problem originates)
    If the receiver knows it is a pdf file, they can drag it into Acrobat, but renaming the extension serves future use.

  • How to send a pdf file via http call

    Hi Experts,
    Please try to think on how you would send a file like a pdf file via the http call. You might need to convert the pdf in a character string which can be sent via http. The character string then might need to  get converted back into a pdf and saved in a file. Read through the Archive Link API guide to see how they send the body of a file.
    Please it is urgent......
    Thanks
    Basu

    so you want to push the PDF file over http to external system.
    where is pdf file stored.
    for examle if its in the clients desktop, you can use gui_upload to upload to internal tabble (type BIN) then use FM SCMS_BINARY_TO_XSTRING to conver the binary table to type string.
    then use cl_http_client class to push the file to the destination.

  • Download file via jsp

    dear all,
    to download a *.txt-file via jsp i use following code:
    java.io.File file = new java.io.File("C:\\FileName.txt");
    response.setHeader("Content-Disposition", "attachment;filename=\""+file.getName()+"\";");
    response.setContentType("APPLICATION/OCTET-STREAM");
    response.setContentLength((int) file.length());
    if(file.isFile()){
         java.io.FileInputStream fis = new java.io.FileInputStream(file);
         java.io.BufferedOutputStream bos = new java.io.BufferedOutputStream(response.getOutputStream());
         byte b[] = new byte[(int)file.length()];
         int read = 0;
         while((read = fis.read(b)) != -1){
              bos.write(b,0,read);
         bos.flush();
         fis.close();
         bos.close();
    } the problem is:
    the file will be displayed in the browser IE6 (inline), but i want to open a save-dialog!
    any ideas?!
    thanks for help. andy

    up to now i tried another browser (mozilla firebird) and several settings about the contenttype like:
    - application/x-download
    - application/x-msdownload
    - application/x-octet-stream
    - application/octet-stream
    - application/download
    ... and the file-name like:
    *.zip
    *.txt
    *.exe
    but the browser shows the content of the file always inline (even *.zip and *.exe files!!).
    anyway, thank you for help.
    andy

  • "Error attempting to read file" at Webservice call from Adobe Form.

    Hi Experts,
    We have designed a Webservice form a Function Module in ECC 6.0, In the soamanager transaction the webservice works fine. But at the time of call from the Adobe form, it gives an error stating that "Error attempting to read from file" and then the URL of the Webservice to be excuted.
    and if i attempt to open that file, it gives me this error:
    - <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
      <soap-env:Header />
    - <soap-env:Body>
    - <soap-env:Fault>
      <faultcode>soap-env:Server</faultcode>
      <faultstring xml:lang="en">SRT: Wrong Content-Type and empty HTTP-Body received</faultstring>
    - <detail>
    - <ns:SystemFault xmlns:ns="http://www.sap.com/webas/710/soap/runtime/abap/fault/system/">
      <Host>undefined</Host>
      <Component>COREMSG</Component>
    - <ChainedException>
      <Exception_Name>CX_SOAP_CORE</Exception_Name>
      <Exception_Text>SRT: Wrong Content-Type and empty HTTP-Body received</Exception_Text>
      </ChainedException>
      </ns:SystemFault>
      </detail>
      </soap-env:Fault>
      </soap-env:Body>
      </soap-env:Envelope>
    In case I give my user the "SAP_ALL" role, this all works fine, so i think it is somewhere related to a missing role to be assigned.
    any clues..??
    any help would be appreciated, Please help..
    Thanks,
    Amita

    Hi Juergen,
    I am using it as a WSDL based data connection.
    How do i check this WSDL through a web browser? I have checked it through SICF Transaction code, It gives the output in explorer as given in the first post of this thread..
    Please help me resolving this issue, i feel that this issue is somewhere related to the role assignment of the user as if i provide this user an authorization of SAP_ALL then everything starts working fine, but after removing SAP_ALL this error is encountered, do u hav any pin points on this??
    Thanks
    Amita

  • Issue with selecting or copying a phone no. in dialing or direct calling from websites

    Dear All,
    I remarked that in Z10 I cannot use  in dialing screen neither copy/paste phone numbers nor calling direct from email or websites by selecting the phone no. and taping on it.
    This seems to be a bit annoying when you try to make a call from web or inside the email text, because you do not have even the possibility to paste the copied number into the dialing screen.
    Somebody knows if is possible to do it, as in the other phones ?
    Thanks !

    The dial pad does not allow you to paste a number. But within an email, text message, web site, BBM message, if its a valid phone number example 416-967-1111, it shows the number as blue, Just clik and hold it and a slider appears on the right(copy, call, send text message, View contact, share/NFC, share, ope in). If you just tap it, it will start to dial the number.

  • Javascript calls from flash send GET request

    I'm having this problem with calling a javascript function
    after opening a new URL from flash. Basically what I have going on
    in my flash is a button, that when clicked, opens a new URL in
    "_blank" sending values to it using a POST request (I have done
    this both by using getURL and by using a LoadVars object). This
    part works fine, however immediately after it, I have a call to the
    javascript function "window.close()" (which I have done both using
    getURL and ExternalInterface). This works great in Firefox, but in
    IE the POST request seems to be getting interrupted by the
    javascript call.
    I did a check on the values getting passed using Charles, and
    it clearly shows that in IE there is a POST request getting sent to
    the page I'm loading in the new window, immediately followed by a
    GET request. This get request overrides the POST and for some
    reason only appears when making a javascript called. If I change
    that javascript call to opening a new URL in _self, for example, it
    doesn't show up.
    Does anyone have any idea what this is all about? Is there a
    solution to this? Why is this happening?!

    Thanks for the speedy reply!
    I'll just have to double check to make sure that any of the AJAX calls are security checked.

  • Download file via terminal

    I want to download a http file via terminal, whats the command?

    curl -O http://path-to-file
    or
    curl -O ftp://path-to-file
    etc.
    FYI, That's the letter Oh, not the number Zero

  • Downloading file via HTTP

    Hi,
    is it possible or exist some adapter or service, which can
    process(or download) file placed on HTTP server?
    Thanks
    Martin

    Chtira,
    I've done it in JDeveloper with HttpServlet class and not in BPEL. I've overridden the doGet and doPost methods.
    doGet looks something like this:
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
        throws ServletException, IOException
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title>Communication</title></head>");
        out.println("<body>");
        out.println("<p>GET method is not supported. Please use POST method for XML messages.</p>");
        out.println("</body></html>");
        out.close();
      }doPost method is a bit more complicated. Basically I'll call my BPEL processes with the XML messages I receive but I'm still struggling with XML validation against a schema in this servlet class.
    When you have the class you have to put something like
      <servlet>
        <servlet-name>HttpServletPost</servlet-name>
        <servlet-class><your package>.HttpServletClass</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
         <servlet-name>HttpServletPost</servlet-name>
         <url-pattern>/Communication/*</url-pattern>
      </servlet-mapping> in your web.xml file.
    Hope this helps you somehow.
    BB

  • Cannot download files via Bluetooth since upgrading to Yosemite

    I cannot download files, E.G. photos and spreadsheets, from my Windows phone to my MacBook Pro Retina since upgrading to OS 10.10 Yosemite.
    I can send files from the MacBook Pro to the Windows phone.
    Tried resetting PRAM, no luck
    Tried unpairing and repairing all devices, no luck
    Tried dumping "bluetooth.plist", no luck
    Tried cold start & Resart after each, no luck
    Devices are paired. Bluetooth Sharing is on.
    Help!

    PROBLEM SOLVED:
    Go to "System Preferences" - "Sharing" - "Bluetooth Sharing" - "Folder for selected items:", and select a folder."
    No folder is selected.
    Prior to the upgrade the Folder had been set to "Downloads", so I reset it to "Downloads" and it now works.
    Praise the Lord!!

Maybe you are looking for

  • Display current month records only

    Hi Experts, I have the following requirement. Report should display current month records only. For example If the report is run on 20090324, It should display records from 20090301 to 20090324. That means,  report may run on any date of that month,

  • Some photos will not sync from iPhoto to iPad

    I could REALLY use some help. For starters, here is what I am working with: iPad3, 64 Gigs, 32 gigs free, up to date iOS Mac Pro with OSX 10.8.3 and iPhoto 9.4.2 The main problem is that some photos can not be synced to my iPad. I have done this for

  • Oracle Tree Hierarchy Query

    Hi, Hoping someone can assist with this query: I am currently using this query to construct a tree hierarchy, i.e. SELECT "EMP"."MGR" as "MGR",         "EMP"."EMPNO" as "EMPNO",         "EMP"."ENAME" as "ENAME" ,         (select count(*)  from "EMP"

  • SCCM 2012 App-V 5 Virtual Enviroments Not Created During OSD or Task Sequence

    Hi all, I'm in the process of adding some App-V 5 applications into our SCCM 2012 R2 OSD Windows 7 builds. If I install an App-V application which is in a virtual environment, and all applications that are in the virtual environment are installed dur

  • How do I integrate ICS5.x with openLDAP?