1

I'm hard stuck with this one so any advice welcome!

Ive been trying to create a flow that goes to this website https://dlv.tnl-uk-uni-guide.gcpp.io/ and scrapes the data from each table in the Subject Areas drop down list. My knowledge of HTML is sketchy at best but from what I understand it's a dynamic html table that just refreshes with new data rather than going to a new url. I can extract the subject list as a variable and in my head i think i just need to add this to a UI selector action but despite numerous attempts i've got absolutely nowhere. Anyone got any ideas as to how i could fix this or work around?

Table and Subject Drop Down

Skin
  • 9,085
  • 2
  • 13
  • 29
Chris H
  • 13
  • 3

2 Answers2

1

Because it is not a conventional drop-down using the "Set drop-down list value on web page" doesn't work all that well.

You can use a bit of javascript and variables for this.

Hit F12 to show developer tools, you will see there is a list of hidden items with the class class="gug-select-items gug-select-hide" you will use this in the javascript.

enter image description here

Then add a 'Press button on web page' function and add the 'drop-down' element, which is a <div>

enter image description here

Then edit the element selector and change it to text editor.

enter image description here

then change the selector to make use of the nth-child(0) selector but use a variable for the index. so it looks something like #gug-overall-ranking-select > div.gug-select-items > div:nth-child(%ddIdx%)

Use the "Run JavaScript function on web page" function to get the number of options available to the drop-down. (child elements) The returned result is text, so convert it to a number that can be used in the loop.

function ExecuteScript() { /*your code here, return something (optionally); */ 
var firstDDlist = document.querySelector("#gug-overall-ranking-select > div.gug-select-items.gug-select-hide");
return firstDDlist.children.length;
}

In the loop each element will be pressed and cause the table to reload.

The table data extraction can then also be done in the loop, but that this code only shows the looping through the options.

The full flow 'code' (copy this and paste it in power automate).

WebAutomation.LaunchEdge.LaunchEdge Url: $'''https://dlv.tnl-uk-uni-guide.gcpp.io/?taxonomyId=36&/#gug-university-table''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser

WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript() { /*your code here, return something (optionally); */ 
var firstDDlist = document.querySelector(\"#gug-overall-ranking-select > div.gug-select-items.gug-select-hide\");
return firstDDlist.children.length;
}''' Result=> numberOfItems

Text.ToNumber Text: numberOfItems Number=> itemCount

LOOP ddIdx FROM 1 TO itemCount STEP 1
    WebAutomation.PressButton.PressButton BrowserInstance: Browser Control: appmask['Web Page \'h ... sity-table\'']['Div \'gug-select-selected\''] WaitForPageToLoadTimeout: 60
END

It should end up looking like this: enter image description here

Flow running: enter image description here

CobyC
  • 2,058
  • 1
  • 18
  • 24
0

With using Power Automate Desktop (PAD), the goal is to be a low-code solution. Of course knowing HTML is a bonus and will help you on tricky webpages or problems, but not knowing much is alright usually. I'm not really comfortable going to that web page you shared but you could try the below option.

PAD has a built in function in the action pane: 'Browser automation' > 'Web data extraction' > 'Extract data from web page'

Try using that and when asked to add UI Element select the table/dropdown list to see what information you get back. If that doesn't work you might need to try out JavaScript or another method.

data_sc
  • 459
  • 1
  • 6