Fill in value on the Internet page

0
So I want to put a value on a web page, but before that I log in and I'm directed to another page, there I navigate to a different page, and I took a look at the page code and where I want it put the information has the name part, at first it would be the same as logging into the page, but for some reason I am not able to put the value on this page.

Private Sub UserForm_Activate()
Dim senha, usuario

sURL = "http://tx3.travian.com.br/" ' Navego até o site
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.navigate sURL
oBrowser.Visible = True

Do
' Espera a página carregar
Loop Until oBrowser.readyState = READYSTATE_COMPLETE

Set HtmlDoc = oBrowser.document

HtmlDoc.all.Name.Value = "" ' aqui coloco meu login
HtmlDoc.all.Password.Value = "" ' aqui coloco minha senha
HtmlDoc.all.lowRes.Click   ' clico em um botao
HtmlDoc.all.s1.Click      'click no botao de login

Do While oBrowser.Busy
DoEvents
Loop
oBrowser.navigate (sURL & ("build.php?tt=2&id=39"))    ' navego até a pagina que quero ir
Do While oBrowser.Busy
DoEvents
Loop
HtmlDoc.all.s4.Value = "4"      'É aqui o problema, quero colocar uma informacao aqui, é igual ao local onde boto minha senha e conta, mas por algum motivo dá erro. 
End Sub

What I could do here

    
asked by anonymous 15.07.2015 / 18:57

2 answers

1

After the lines

oBrowser.navigate (sURL & ("build.php?tt=2&id=39"))    ' navego até a pagina que quero ir
Do While oBrowser.Busy
DoEvents

You need to reload the document with:

Set HtmlDoc = oBrowser.document
    
16.07.2015 / 13:27
0

Follow my code after "change"

'Dim password, user

sURL=" link " 'Navigate to the site

Set oBrowser = New InternetExplorer

oBrowser.Silent = True

oBrowser.navigate sURL

oBrowser.Visible = True

Do 'Wait for page load

Loop Until oBrowser.readyState = READYSTATE_COMPLETE

Set HTMLDoc = oBrowser.document

HTMLDoc.all.Name.Value="Bey" 'here I enter my login

HTMLDoc.all.Password.Value="patrick10" 'here I enter my password

HTMLDoc.all.lowRes.Click 'I click on a button

HTMLDoc.all.s1.Click 'click the login button

Do While oBrowser.Busy

DoEvents

Loop

oBrowser.navigate (sURL & ("build.php? tt = 2 & id = 39")) 'navigate to the page I want to go to

Do While oBrowser.Busy

DoEvents

Loop

Set HTMLDocu = oBrowser.document

HTMLDocu.all.t4.Value="9" '

    
17.07.2015 / 19:45