none
Correct address through Internet Explorer automation and USPS.COM

    Dotaz

  • Hello everyone,
    I'm trying to correct an address usiing the United States Postal Sevice through COM automation with IE9. Below is the code streamlined:
    DECLARE INTEGER Sleep IN WIN32API INTEGER nTimeout
    
    oIE   = CREATEOBJECT("InternetExplorer.Application")
    oIE.Navigate("https://tools.usps.com/go/ZipLookupAction!input.action?mode=0&refresh=true")
    oIE.Visible = .T.
    
    DO WHILE oIE.Busy = .T.
    	DOEVENTS
    	LOOP
    ENDDO
    
    DO WHILE oIE.ReadyState <> 4
    	Sleep(100)
    ENDDO
    
    oIE.Document.All("tAddress").Value = "1320 NW 14 ST"
    oIE.Document.All("tApt").Value = ""
    oIE.Document.All("tCity").Value = "Miami"
    
    oIE.Document.All("sState").Value = "FL"
    oIE.Document.All("Zzip").Value = "33125"
    oIE.Document.Forms(0).Submit()
    
    OIE.Quit

    I have two problems:
    1 - The line:  oIE.Document.All("sState").Value = "FL" ; points to a dropdown and it doesn't seem to respond to the value assignment.
    2 - I can't have the form to submit the values populated in the fields. I tried looking the source of the form to find the elements name
    and use those names to no avail.
    oIE.Document.Forms(0).Submit()
    oie.DOCUMENT.FORMS.lookupZipFindBtn.Submit()
    Any suggestions?
    Thanks in advance,
    Luis
     
    • Přesunutý Mike Feng 24. listopadu 2011 13:56 VBS (From:Visual FoxPro General)
    21. listopadu 2011 21:32

Všechny reakce