• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Website login - clicking the signin button is erasing username & Pass....

Hi All,

I am using the the following code to sign in to a website. The code correctly enters the username and password. While clicking the sign in button username and password is erased. Can you please help me to successfully login.

Thanks
Code:
Sub Daralogin()
    Dim ie As SHDocVw.InternetExplorer
    Dim idoc As MSHTML.HTMLDocument
    Dim username As HTMLInputElement
    Dim Passw As HTMLInputElement
    Dim signin As Object
   
    Set ie = New SHDocVw.InternetExplorer
    ie.Visible = True
    ie.navigate "https://sellercenter.daraz.lk/seller/login?redirect_url=https%3A%2F%2Fsellercenter.daraz.lk%2Fproduct%2Fpublish%2Findex%3Fspm%3Da2o7e.10547927.old-navigation.3.50f42a97yqWAyz"

    Do While ie.readyState <> READYSTATE_COMPLETE
       Application.StatusBar = "Loading"
    Loop
    Set idoc = ie.document
   
    Set username = idoc.getElementById("TPL_username")
    username.Value = "cobbler2050@gmail.com"
   
    Set Passw = idoc.getElementById("TPL_password")
    Passw.Value = "Cobbler1981"
   
     
    Set signin = idoc.getElementsByClassName("next-btn next-btn-normal next-btn-medium btn")
    signin(0).Click
   
       
    End Sub
 
Last edited:
I have entered invalid details above. However, even with the valid details, website erase both username and password. I have updated the code with valid username and password
 
OK, the details are valid now and I can login manually, however, you're right those fields do get wiped and you're not allowed in.
However, once I had logged in I noticed they have an API, with documentation, even a visual basic section - would you be able to do something with that?
64920
There's an API test tool which generates urls for you too.
 
This got me in, but you may have to reinstate some Application.Waits:
Code:
Sub Daralogin()
Dim ie As SHDocVw.InternetExplorer
Dim idoc As MSHTML.HTMLDocument
Dim username As HTMLInputElement
Dim Passw As HTMLInputElement
Dim signin As Object
  
Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.navigate "https://sellercenter.daraz.lk/seller/login?redirect_url=https%3A%2F%2Fsellercenter.daraz.lk%2Fproduct%2Fpublish%2Findex%3Fspm%3Da2o7e.10547927.old-navigation.3.50f42a97yqWAyz"

Do While ie.readyState <> READYSTATE_COMPLETE
  Application.StatusBar = "Loading"
Loop
Set idoc = ie.document
Set username = idoc.getElementById("TPL_username")
username.Focus
Application.Wait (Now + 0.00001)
SendKeys "cobbler2050@gmail.com"
Set Passw = idoc.getElementById("TPL_password")
'Application.Wait (Now + 0.00001)
Application.Wait (Now + 0.00001)
Passw.Focus
'Application.Wait (Now + 0.00001)
SendKeys "Cobbler1981"
'Application.Wait (Now + 0.00001)
SendKeys "{TAB}"
'Application.Wait (Now + 0.00001)
SendKeys "~"
End Sub
 
This got me in, but you may have to reinstate some Application.Waits:
Code:
Sub Daralogin()
Dim ie As SHDocVw.InternetExplorer
Dim idoc As MSHTML.HTMLDocument
Dim username As HTMLInputElement
Dim Passw As HTMLInputElement
Dim signin As Object
 
Set ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.navigate "https://sellercenter.daraz.lk/seller/login?redirect_url=https%3A%2F%2Fsellercenter.daraz.lk%2Fproduct%2Fpublish%2Findex%3Fspm%3Da2o7e.10547927.old-navigation.3.50f42a97yqWAyz"

Do While ie.readyState <> READYSTATE_COMPLETE
  Application.StatusBar = "Loading"
Loop
Set idoc = ie.document
Set username = idoc.getElementById("TPL_username")
username.Focus
Application.Wait (Now + 0.00001)
SendKeys "cobbler2050@gmail.com"
Set Passw = idoc.getElementById("TPL_password")
'Application.Wait (Now + 0.00001)
Application.Wait (Now + 0.00001)
Passw.Focus
'Application.Wait (Now + 0.00001)
SendKeys "Cobbler1981"
'Application.Wait (Now + 0.00001)
SendKeys "{TAB}"
'Application.Wait (Now + 0.00001)
SendKeys "~"
End Sub
Many thanks !
 
Back
Top