I am trying to download tracking information from FedEx's website. First I have to pass login credentials and then navigate to a webpage which triggers an automatic download. My code so far works fine for this. However; as soon as the download is triggered a popup comes up asking if I want to save the file and then when I click save I asks where I want to save the file to. I want to disable the popups and have the file just automatically saved in my downloads folder. Is there a way to do this? Thanks in advance for any help! Here is my code so far.
    Dim WebBrowser1 As New WebBrowser
    Dim url As String = "https://www.fedex.com/insight/manifest/manifest.jsp?&__QS=252D0F3B4E380B211B122B1A09251510050E0F5C273A223E34360539237976645E45745E57776C&"
    WebBrowser1.Navigate(url)
    WebBrowser1.ScriptErrorsSuppressed = True
    Threading.Thread.Sleep(2000)
    Application.DoEvents()
    Do Until WebBrowser1.IsBusy = False
        Threading.Thread.Sleep(1000)
        Application.DoEvents()
    Loop
    WebBrowser1.Document.GetElementById("username").SetAttribute("value", "MyUsername")
    WebBrowser1.Document.GetElementById("password").SetAttribute("value", "MyP@ssw0rd")
    WebBrowser1.Document.GetElementById("login").InvokeMember("click")
    Threading.Thread.Sleep(1000)
    Application.DoEvents()
    Do Until WebBrowser1.IsBusy = False
        Threading.Thread.Sleep(1000)
        Application.DoEvents()
    Loop
    WebBrowser1.Navigate("https://www.fedex.com/insight/manifest/download_post.jsp?VIEW=|Outbound_View&INFOTYPE=STATUS")
    Do Until WebBrowser1.IsBusy = False
        Threading.Thread.Sleep(1000)
        Application.DoEvents()
    Loop
So I tried this code but all this does is still just download the page's source.
Using client As New WebClient()
        client.Headers("User-Agent") = "Mozilla/4.0"
        client.Credentials = New NetworkCredential("Username", "P@sword")
        client.Credentials = CredentialCache.DefaultCredentials ' << if Windows Authentication
        Dim content As String = client.DownloadString("https://www.fedex.com/insight/manifest/download.jsp?VIEW=/Outbound_View")
        Console.WriteLine(content.Substring(0, 15))
    End Using
I checked the webpage's source again to try to find a different url but also could not find anything else. I was wondering if it would be easier to download using WebBrowser.Navigate and then suppress the popups. Is there away to suppress or get rid of the download popups in vb? I am just not having much success with the WebClient. Thanks for all the help as I am still pretty new at vb.net!
