Webbrowser Elementlerin İd'erini Bulmak

24/06/2019, 08:32

mustinba

İyi çalışmalar.
Chrome öğeyi denetlediğimde;

<td class="dataGridActive" align="center">
                <input name="dgListem$ctl02$txtY1" type="text" value="47" maxlength="3" 

id="dgListem_txtY1_0" 

disabled="disabled" class="aspNetDisabled frmInputDisabled2" onfocus="Renk(this.id,this,1);" *****width:40px;">
                </td>

böyle bir kod geliyor.
Benim yapmak istediğim örnek Html sayfasında 1.sınav sütunundaki hücrelerin id'lerini listeye yazdırmak.

(örneğin:dgListem_txtY1_0
dgListem_txtY1_1"
dgListem_txtY1_2"
.....)  
26/06/2019, 21:23

berduş

dilerim  işinize yarar[attachment=30402][attachment=30403]
28/06/2019, 16:01

mustinba

(26/06/2019, 21:23)halily yazdı: dilerim  işinize yarar
 Arşiv Hasarlı hatası.
28/06/2019, 16:22

berduş

mesaj 2'yi güncelledim.
zip olarak da ekledim, farklı winrar sürümüyle denediniz mi?
form1'e eklenen kodlar:

#If VBA7 And Win64 Then '64 bit için
Private Declare PtrSafe Function URLDownloadToFileA Lib "urlmon" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
 
#Else '32 bit için
Private Declare  Function URLDownloadToFileA Lib "urlmon" (ByVal pCaller As Long, _
ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long

#End If
buton3'ün kodu
Private Sub Komut3_Click()
Dim TextFile As Integer
Dim FilePath As String
Dim FileContent As String
Dim txtAranan As String
Dim xYer As LongLong
Dim x As Integer
'File Path of Text File
On Error Resume Next
FilePath = Application.CurrentProject.Path & "\template.txt"
If Len(Dir$(FilePath)) > 0 Then Kill FilePath
'On Error GoTo 0
Open FilePath For Output As #1
'Print #1, "Boş"
Close acSaveYes
DownloadFile "file:///" & Application.CurrentProject.Path & "/dersnotu.html", FilePath ' "D:\Google.txt"

txtAranan = "dgListem_txtY1_"
'Determine the next file number available for use by the FileOpen function
  TextFile = FreeFile

'Open the text file in a Read State
  Open FilePath For Input As TextFile

'Store file content inside a variable
  FileContent = Input(LOF(TextFile), TextFile)

'Clost Text File
  Close TextFile
  Liste1.RowSource = ""
'Find
'Deneme____________________________
x = 0
Do
xYer = InStr(1, FileContent, txtAranan & x)
'If xYer > 0 Then Debug.Print txtAranan & x
If xYer > 0 Then Liste1.AddItem txtAranan & x
x = x + 1
Loop While xYer > 0
'Deneme____________________________BİTTİ

'Determine the next file number available for use by the FileOpen function
  TextFile = FreeFile

'Open the text file in a Write State
  Open FilePath For Output As TextFile
 
'Write New Text data to file
  Print #TextFile, FileContent

'Close Text File
  Close TextFile
FilePath = Application.CurrentProject.Path & "\template.txt"
If Len(Dir$(FilePath)) > 0 Then Kill FilePath
'  MsgBox ("Bitti")
End Sub
eklenen fonksiyon:
Private Function DownloadFile(URL As String, LocalFilename As String) As Boolean
'Thanks Mentalis
Dim lngRetVal As Long
lngRetVal = URLDownloadToFileA(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
28/06/2019, 16:39

mustinba

Teşekkürler.
28/06/2019, 17:47

berduş

kodu denedikten sonra olumlu/olumsuz geri bildirimde bulunabilirseniz sevinirim.
iyi çalışmalar.