CSS not found on new Power BI/Query web connector?
Are you having issues with the new connector?
No problem, In this video I will show you how to help Power Query scrape websites that you couldn’t do before and where you are getting the following error:
No CSS selector was found for the sample values you provided.
Watch the tutorial:
If you are getting the following error:
“No CSS selector was found for the sample values you provided” when you are using the new web connector in Power BI, it means that power query has not manage to download all the html code as the site didn’t load before that snapshot was made.
To go around that, you can actually, add a WaitFor parameter that will wait either for the page to load completely or for some html code to load before it grabs the html code.
Here are some examples:
// Wait for ten seconds [WaitFor = [Timeout = #duration(0,0,0,10)]]
// Wait for div.foo to appear (with a default 30-second timeout that will throw if div.foo hasn’t shown up yet) [WaitFor = [Selector = “div.foo”]]
// Wait for div.foo to appear with a ten second timeout [WaitFor = [Selector = “div.foo”, Timeout = #duration(0,0,0,10)]]
Here are the modified functions that should unblock the two sites you tried: · = Web.BrowserContents(“https://www.flashscore.com/basketball/”, [WaitFor=[Selector=”li.ifmenu-all”]]) · = Web.BrowserContents(“https://www.fec.gov/data/elections/president/2016/”, [WaitFor=[Selector=”div.dataTables_paginate”]])
Links to the mentioned resources
Get file #28 in the Community Downloads folder at Curbal Download center