Manipulation des popup AJAX

foued2d Messages postés 2 Date d'inscription vendredi 11 février 2011 Statut Membre Dernière intervention 24 mars 2012 - 24 mars 2012 à 10:16
foued2d Messages postés 2 Date d'inscription vendredi 11 février 2011 Statut Membre Dernière intervention 24 mars 2012 - 24 mars 2012 à 10:17
Bonjour à tous,

J'ai fait un code qui me permet de me connecter à une page web (via internet explorer), de manipuler la page afin de déterminer les paramètres d'un formulaire et d'envoyer ce formulaire. Le formulaire, une fois envoyé, permet le téléchargement d'un fichier...

En retour, j'ai un popup AJAX qui s'affiche et qui me demande si je souhaite 'Ouvrir', 'Enregistrer' ou 'Annuler'. De ce que je comprends, AJAX n'update pas la page entière mais envoie des bouts de code pour updater la page en cours ; soit!

Cependant, le popup est bel et bien présent dans ma page internet ; existe t'il un moyen pour manipuler ce popup?

J'ai lu des articles sur Webbrowser (afin de manipuler le flux d'info de la page) mais je n'ai rien trouvé de satisfaisant.

Merci d'avance.

Mon code:

Dim myIE As New SHDocVw.InternetExplorer
Dim myHTML As mshtml.HTMLDocument
Dim myElement As mshtml.HTMLDivElement
Dim mySubElem As mshtml.HTMLInputElement
Dim testnb As Integer = 0


If IBconnect.MarketPlaceChoice.Text "Paris" Or IBconnect.MarketPlaceChoice.Text "Amsterdam" Then

On Error Resume Next
myIE.Navigate("http://www.euronext.com/search/download/trapridownloadpopup-1800-FR.html?country=FRA&resultsTitle=Tout+Euronext+-+Euronext&totalOfInstruments=630")
While myIE.Busy
If Err.Number > 0 Then Call ErrorMsg("Issue with the Euronext URL...")
Threading.Thread.Sleep(1250)
End While

retry:
myHTML = myIE.Document
myElement = myHTML.getElementById("formatDecimalID")

If Err.Number > 0 Then
If testnb = 2 Then Call ErrorMsg("Issue with the Euronext page format...")
testnb = testnb + 1
Threading.Thread.Sleep(1250)
Err.Number = 0
GoTo retry
End If

For Each mySubElem In myElement.childNodes
If mySubElem.ToString() = "mshtml.HTMLInputElementClass" Then
If mySubElem.value Configuration.ConfigurationManager.AppSettings("DecFormat") Then mySubElem.checked True
End If
Next

myElement = myHTML.getElementById("formatDateID")
If Err.Number > 0 Then Call ErrorMsg("Issue with the Euronext page format...")
For Each mySubElem In myElement.childNodes
If mySubElem.ToString() = "mshtml.HTMLInputElementClass" Then
If mySubElem.value Configuration.ConfigurationManager.AppSettings("DateFormat") Then mySubElem.checked True
End If
Next
For Each myForms In myHTML.forms
If myForms.name = "formFormat" Then myForms.submit()
Next

While myIE.Busy
If Err.Number > 0 Then Call ErrorMsg("Issue with the Euronext URL...")
Threading.Thread.Sleep(2000)
End While

Et là... popup qui apparaît...


Merci d'avance à ceux qui pourront aider!

1 réponse

foued2d Messages postés 2 Date d'inscription vendredi 11 février 2011 Statut Membre Dernière intervention 24 mars 2012
24 mars 2012 à 10:17
Avec le bon format, c mieux...

Dim myIE As New SHDocVw.InternetExplorer
Dim myHTML As mshtml.HTMLDocument
Dim myElement As mshtml.HTMLDivElement
Dim mySubElem As mshtml.HTMLInputElement
Dim testnb As Integer = 0


If IBconnect.MarketPlaceChoice.Text "Paris" Or IBconnect.MarketPlaceChoice.Text "Amsterdam" Then

On Error Resume Next
myIE.Navigate("http://www.euronext.com/search/download/trapridownloadpopup-1800-FR.html?country=FRA&resultsTitle=Tout+Euronext+-+Euronext&totalOfInstruments=630")
While myIE.Busy
If Err.Number > 0 Then Call ErrorMsg("Issue with the Euronext URL...")
Threading.Thread.Sleep(1250)
End While

retry:
myHTML = myIE.Document
myElement = myHTML.getElementById("formatDecimalID")

If Err.Number > 0 Then
If testnb = 2 Then Call ErrorMsg("Issue with the Euronext page format...")
testnb = testnb + 1
Threading.Thread.Sleep(1250)
Err.Number = 0
GoTo retry
End If

For Each mySubElem In myElement.childNodes
If mySubElem.ToString() = "mshtml.HTMLInputElementClass" Then
If mySubElem.value Configuration.ConfigurationManager.AppSettings("DecFormat") Then mySubElem.checked True
End If
Next

myElement = myHTML.getElementById("formatDateID")
If Err.Number > 0 Then Call ErrorMsg("Issue with the Euronext page format...")
For Each mySubElem In myElement.childNodes
If mySubElem.ToString() = "mshtml.HTMLInputElementClass" Then
If mySubElem.value Configuration.ConfigurationManager.AppSettings("DateFormat") Then mySubElem.checked True
End If
Next
For Each myForms In myHTML.forms
If myForms.name = "formFormat" Then myForms.submit()
Next

While myIE.Busy
If Err.Number > 0 Then Call ErrorMsg("Issue with the Euronext URL...")
Threading.Thread.Sleep(2000)
End While 

0
Rejoignez-nous