Mike P.
Mike P.

Reputation: 61

How to get data from a website that can only be viewed in chrome

I'm trying to automate a way to pull data from a website but that website only allows me to view in chrome, firefox, safari, or opera.

I added the url into excel to power query but I'm not able to get the data I'm looking for as I get this error message below.

Any suggestions or recommendations are highly appreciated.

web address wont work with ie

Upvotes: 1

Views: 249

Answers (2)

Jacob
Jacob

Reputation: 59

If you've already tried on internet explorer and it didn't work I would suggest trying the following function

dim ie as internetexplorermedium

It helps if you have securities on internet explorer. It will make your life much easier if you can use that instead.

Upvotes: 0

JPR
JPR

Reputation: 642

You can use Selenium Basic. It will require the end user to have that framework installed, but works like a charm when Internet Explorer and MSXML aren't an option (if MSXML works, that would be preferable as it is the fastest way to retrieve data - you can find examples and explanations here as recommended by QHarr).

Note: you'll also have to update the driver that originally comes with the framework installation (you can get the latest driver for chrome here and the file to be replaced can be found in the root folder of Selenium Basic's installation C:\Users\%UserProfile%\AppData\Local\SeleniumBasic).

You'll have to select the appropriate reference within the VBA IDE: "Selenium Type Driver" and then the code goes like this:

Public Sub SeleniumImplementation()
    Dim driver As New Selenium.WebDriver ' in older versions was SeleniumWrapper.WebDriver

    'Late binding would be:
    'Dim driver As Object
    'Set driver = CreateObject("Selenium.WebDriver")

    driver.start "chrome", "http://news.yahoo.com"
    driver.open "/politics"
    driver.stop
End Sub

You should be able to get the rest of the syntax from the autocomplete and object browser and you can take a look at more code examples here.

If Chrome is too slow, you can try PhantomJS which comes with Selenium's installation.

(Note: the code is untested.)

Upvotes: 1

Related Questions