PDA

View Full Version : Change from Internet Explore to Google Chrome



clif
01-08-2018, 12:02 AM
Don't know how to convert from Internet Explore to Google Chrome (Get the data from html)



Dim chromePath As String

Dim custid As Long
Dim Lastrow2 As Long

Sheets("abc").Select
With ActiveSheet
Lastrow2 = .Cells(.Rows.Count, "A").End(xlUp).Row

For custid = 2 To Lastrow2


chromePath = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"""


Shell (chromePath & " -url http://abc.com?id=View&sCustid=" & Sheets("main").Cells(custid, 10).Value)


The below part, I don't know how to convert?



Dim objIe As Object, xobj As Object


Set objIe = New InternetExplorerMedium

objIe.Visible = True



While objIe.Busy: DoEvents
Wend
Do
Loop Until Not (objIe.Busy)



Dim a As Long

For a = 1 To 20

Set xobj = objIe.document.getElementById("abc")
Set xobj = xobj.getElementsByClassName("Start").Item(0)
Set xobj = xobj.getElementsByTagName("td")(a)

Sheets("1").Cells(1, a) = xobj.innerText

Next a

p45cal
01-08-2018, 04:32 AM
A Google search for excel vba chrome api revealed:
https://www.makeuseof.com/tag/how-to-automate-firefox-or-chrome-with-vba-and-selenium/
https://github.com/florentbr/SeleniumBasic
https://codingislove.com/browser-automation-in-excel-selenium/
which should get you started.