Click date if text appears in description

I’m having some trouble with a automation. Below is the website I’m trying to work with. The Automation will check the website daily for updates. The automation should work like so.

  1. Open web Page: https://www.treasury.gov/resource-center/sanctions/ofac-enforcement/pages/ofac-recent-actions.aspx

2.If Designations and or update is found in the description and the date matches current date then click date link.

3.If designations and removal is in the description then kill the process. Only needs to check the first date and description on the web page

  1. please see attached picture

Hey @NATHAN_MORA,

I have had a look at the website you’re automating on. Use a Get Text to get the description. Because the descriptions and dates are in a table, the selector looks something like this:

<webctrl parentid='ctl00_PlaceHolderMain_ctl04_ctl01__ControlWrapper_RichHtmlField' tag='TABLE' /> <webctrl tableCol='3' tableRow='3' tag='TD' />

You can change the tableRow index to a variable, and this will cycle through the rows in the table. I believe that the rows start at 3.

Scrape the description, then use an If statement to see if the description contains Designations or Removal. If it does, then add one to the tableRow (dynamic selector with an int variable in place of the number). If it doesn’t contain Designations or Removal, then click the date.

The selectors below are examples of dynamic selectors that should work:

Description:
"<webctrl parentid='ctl00_PlaceHolderMain_ctl04_ctl01__ControlWrapper_RichHtmlField' tag='TABLE' /> <webctrl tableCol='3' tableRow='"+intVariable.ToString+"' tag='TD' />"

Date:
"<webctrl parentid='ctl00_PlaceHolderMain_ctl04_ctl01__ControlWrapper_RichHtmlField' tag='TABLE' /> <webctrl tableCol='1' tableRow='"+intVariable.ToString+"' tag='TD' />"

Hope this helps!

William,
Thanks for the reply, any chance you could post a workflow ?

Hey @NATHAN_MORA,

I have made one, I will attach it below. I noticed there was an issue with clicking the date, as the selector I made is clicking on the box around the date, and not the actual date. I am sure with some work you will figure it out. I will continue looking in to it also.

Other than that, I think it does what you need it to.

Main.xaml (12.4 KB)

William,
Thanks for this much appreciated!

1 Like

Hey @NATHAN_MORA,

Please mark my previous reply as the solution if everything works fine :slight_smile:

William,
If the word removal is in the description then nothing should happen, if the word designations and or update is in the description then it needs to click on the date. the date should also match the current date. Does this workflow work with those conditions?

@NATHAN_MORA,

The workflow doesn’t currently have those conditions, but they should be easy enough to add. Have a look at some other forum posts and gather some more solutions and add it to that workflow.

The If statment currently skips rows if it contains Designations, so you should change the statement to something like:

Description.Contains("Designations") or Description.Contains("Update")

and then you would have to switch the then/else activities over

Will the automation still work when there is a update to the website under date and description ?

@NATHAN_MORA,

Yes, it should do. It will always take the top record in the table.

Hi @NATHAN_MORA,

Has the workflow I gave you worked? If so, please mark it as the solution to close the topic :slight_smile:

William,
Almost got it working I’m trying to make some changes. i know longer next to check for the word designations. i just need the automation to check the first date and if it matches todays date then click on that link. which shouldn’t be to hard. I’m still a rookie with uipath once i get that to work then i can move on to the next section. Can you make up a quick workflow to check check to see if the date matches today then if so click?

Hi @NATHAN_MORA,

I cannot currently make a workflow, apologies.

You can use an Assign to get today’s date, that would be something like:

DateVar = DateTime.Now.ToString("dd/MM/yyyy")

Then scrape the date with a Get Text (this should be in the workflow I made already?) and compare today’s date and the scraped date in an If statement inside the While Loop I used in the previous workflow:

If DateVar = ScrapedDateVar

If the dates match, then click on the date under the index count used in the While Loop. If not, then add one to the index count.

This will be quite simple to implement, I hope it works.

William,
Roger, once i get this working i will mark as solution.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.