I am trying to connect to a web page in order to load data from a table. However when PQ navigates to the web page the "Disclaimer" page appears. It is then required to press "Accept" or "Cancel" but via PQ it is not able to do this. Is there a way to get around this to get access to the data tables for PQ to work on. Below are some example links and screenshot of PQ web view.
Hi Craig,
Power Query uses IE to access web pages. Have you tried opening the web page in the IE browser and then clicking the Accept button? Once you accept the conditions you don't see that page again the next time you access the page, so that might be enough to get around it.
Mynda
I have now tried it using IE and it did not work for me. I opened the page first in IE and then clicked the Accept button. Then I started web PQ in Excel but the Disclaimer page still shows and does not go any further. Thanks
Hi Maccra,
I tried it and it worked for me. I'm using W10 and IE11.
If I start IE and accept the T&C's I can then browse the site using PQ.
However, when I close IE and restart it, the site asks me to reconfirm the T&C's. So it looks like the site isn't saving cookies past the end of the browsing session.
I opened the site in Chrome and confirmed this. So every time you connect to the site it will ask you to click that Accept button again.
You can use VBA to open the site and accept the Terms, before you run your query. IE needs to stay open while your query is running. Not ideal but the only way around this problem:
Option Explicit
Sub Click_Accept_Button()
Dim IE As Object
Dim AcceptBtn As Object
' Create IE Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
' Load web page
IE.navigate "https://www.bblam.co.th/en/products/mutual-funds/historical-daily-navs?p_code=BFIXED&date_from=20&month_from=09&year_from=2019&date_to=20&month_to=09&year_to=2020"
' Wait while IE loads site
While IE.Busy
DoEvents
Wend
' Locate the Accept button and click it
Set AcceptBtn = IE.Document.getElementsByClassName("cookie-allow")
AcceptBtn(1).Click
While IE.Busy
DoEvents
Wend
Set IE = Nothing
Set AcceptBtn = Nothing
End Sub
Regards
Phil
Thanks for the file and VBA script. The VBA works fine, opens IE and clicks on Accept. However after that, IE is open and running showing the web page, Power Query still does not work and gets stuck at the "Disclaimer" screen and I can not proceed any further as I described in the previous post.
Also different from you, I am able to close the browser and reopen the browser with clicking the Accept button again. So in my case the cookies extend past the current session. At some point they time out but I do not know how long the timer is. This is not only with IE, but with my usual browser, Firefox or Edge (chromium version).
The problem here is the site you are accessing so anything we try is a workaround. You may need to use VBA to scrape the data.
The process I described works for me and leaving IE open isn't an issue. If you are not having the same experience then something must be different on your PC compared to mine.
What version of IE are you using?
Regards
Phil