web scarping with chrome

eran3185

Board Regular
Joined
Apr 28, 2007
Messages
142
I want to do web scarping with vba and chrome.
I can open a url with chrome like this:
chromePath = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Shell (chromePath & " my url ")

Now I want to use getelementbyid or getelementbyname, how to use those elements on my url ?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
I don't think you are going to be able to integrate "chrome" from Google with Excel from Micosoft, !!! If you want to avoid using internet explorer which appears to be the only browser that EXcel support , you could scrape your website using the http object which has the advantage that it is much faster than using a browser.
Try this code which scrapes this website.
VBA Code:
Sub test()
Set MyHTTP = CreateObject("Microsoft.xmlHTTP")
myurl = "https://www.mrexcel.com/board/threads/web-scarping-with-chrome.1133528/"
MyHTTP.Open "GET", myurl, False
  MyHTTP.send

  textmess = MyHTTP.responseText
MsgBox textmess

End Sub
 
Upvote 0
This thread shows how to integrate Chrome and Excel:

 
Upvote 0
TNX.
Its nice solution, but i hope there is another solution that use the shell command, and then I want to use getelementbyid or getelementbyname
 
Upvote 0
As shown below, this solution allows you to get elements by ID or name.

idname.PNG
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top