Johnny Spindler
Johnny Spindler

Reputation: 456

Power Bi - No CSS selector was found for image URL using Examples

My goal in Power BI (August 2022) is to get the images from this webside: https://www.eima.it/en/elenco_espositori.php?APP=&RAGSOC=&RAGSOC__1=agro&NAZIONE=&POSIZIONE=&SETTORE=&PRODOTTI=&Ricerca=Search

So I tried to get data from Web and create a table of image URLs by using "Add table using Examples":

enter image description here

Unfortunatly "No CSS selector was found..." So I tried the "WaitFor" function in the datasource:

= Web.BrowserContents("https://www.eima.it/en/elenco_espositori.php?APP=&RAGSOC=&RAGSOC__1=agro&NAZIONE=&POSIZIONE=&SETTORE=&PRODOTTI=&Ricerca=Search", [WaitFor = [Timeout = #duration(0,0,0,30)]])

But even with the longer Timeout the error remains.

As you can see the Companynames are filled automaticaly but the image URLs just wount.

Here are examples for Names and imageURLs form this page:

AGRO+ Srl https://www.eima.it/images/espositori/loghi/large/4522.jpg

AGROSTAR Srl https://www.eima.it/images/espositori/loghi/large/584.jpg

OLIVER AGRO S.R.L. https://www.eima.it/images/espositori/loghi/large/110528.jpg

RI.MA GROUP Srl https://www.eima.it/images/espositori/loghi/large/1451.jpg

Please let me know if you have any idea on what I am missing.

Upvotes: 1

Views: 182

Answers (1)

davidebacci
davidebacci

Reputation: 30289

Not all the images are showing even when you navigate to that page. The following code seems to collect everything available though.

enter image description here

let
    Source = Web.BrowserContents("https://www.eima.it/en/elenco_espositori.php?APP=&RAGSOC=&RAGSOC__1=agro&NAZIONE=&POSIZIONE=&SETTORE=&PRODOTTI=&Ricerca=Search"),
    #"Converted to Table" = #table(1, {{Source}}),
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Converted to Table", {{"Column1", Splitter.SplitTextByDelimiter("""ricerca"">", QuoteStyle.None), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Column1"),
    #"Inserted Text After Delimiter" = Table.AddColumn(#"Split Column by Delimiter", "Text After Delimiter", each Text.AfterDelimiter([Column1], "<h2>"), type text),
    #"Inserted Text After Delimiter1" = Table.AddColumn(#"Inserted Text After Delimiter", "Text After Delimiter.1", each Text.AfterDelimiter([Column1], "ricLogo"">"), type text),
    #"Removed Columns" = Table.RemoveColumns(#"Inserted Text After Delimiter1",{"Column1"}),
    #"Removed Top Rows" = Table.Skip(#"Removed Columns",1),
    #"Extracted Text Between Delimiters" = Table.TransformColumns(#"Removed Top Rows", {{"Text After Delimiter", each Text.BetweenDelimiters(_, """>", "</a"), type text}}),
    #"Extracted Text Between Delimiters1" = Table.TransformColumns(#"Extracted Text Between Delimiters", {{"Text After Delimiter.1", each Text.BetweenDelimiters(_, "src=""", """"), type text}}),
    #"Renamed Columns" = Table.RenameColumns(#"Extracted Text Between Delimiters1",{{"Text After Delimiter", "Title"}, {"Text After Delimiter.1", "Logo URL"}})
in
    #"Renamed Columns"

Upvotes: 1

Related Questions