มีปัญหา การดึงข้อมูล ผ่านเว็บที่ต้อง login
Posted: Thu Aug 19, 2021 12:14 pm
Code: Select all
Sub facebook()
Dim ie As New InternetExplorer
Set ie = New InternetExplorer
ie.Visible = True
ie.navigate "http://retail.gec.co.th/RetailWeb/common/logon.do"
ie.Visible = True
Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE
ie.document.all.Item("companyID").Value = "cencer"
ie.document.all.Item("userID").Value = "cencer"
ie.document.all.Item("password").Value = "cencer"
ie.document.all.Item("submitbutton").Click
'_______________
Application.Wait Now() + TimeValue("00:00:05")
Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE
Dim ButtonElement As mshtml.HTMLDocument
Dim ButtonElement2 As mshtml.HTMLDocument
ie.document.getElementsByonclick("menu2").Click
'____________________
Exit Sub
โดย
ติด debug ในบรรทัดที่ว่า
Code: Select all
ie.document.getElementsByonclick("menu2").Click
Code: Select all
<A onclick="selectedMenu(2) ;MM_showHideLayers( 'DOCPALL','','hide' ,'CreditNoteCPALL','','hide' ,'PLCPALL','','hide' ,'ReturnCPALL','','hide' ,'POCPALL(BDC)','','hide' ,'InvoiceCPALL(BDC)','','hide' ,'Profile','','hide' ,'Organization','','hide' ,'CPALL','','hide' ,'HomeSupplier','','hide' ,'CPALL','','show')" id=menu2 class=hrefmenu href="/RetailWeb/po7BDCLoadAction.do?act=listPO" target=mainFrame>CP ALL</A>