Hi everyone, I need to get two different currency rates (euro and usd) from a website and then insert those values into Oracle application on a daily basis. When the website opens, it displays today’s rates as default and I need to get yesterday’s currency dates (systemdate-1) for Oracle. Because of that, robot selects the yesterday’s date and the page displays yesterday’s rates. What is the best method to copy those two numerical values?
Screen scraping methods did not work for me because the page changes everyday and page reloads with date selection. When I tried data scraping, the excel output of the datatable had wrong format for numbers(For example currency rate is 10,8234 on the website but it came as 108.234 with data scraping to excel, both the number is wrong and I need comma instead of dot). And I’m scared that if the page owners decide to add or remove some rates from their webpage, the automation would not work because I’m specifying to robot which excel cell values it should get.
What method do you suggest for my case? I am new to uipath and I have wasted so much time on this, so I really would appreciate the help, thanks
Thanks for the reply, but I get an error like this:
Get Attribute ‘SPAN’: Could not find the UI element corresponding to this selector:
[1] <webctrl aaname='10,8094 ' parentid='address-5312b6def4ad0a94c5a992522868ac0a-cc51b5ce6878a3dc655dae2*' tag='SPAN'/>
changing the date to e.g. yesterday will have the table structure as following:
we can get the rate for USD with a get text and a finetuned selector (Done for FireFox, can easy adopt to other browsers):
Selector:
<html app='firefox.exe' title='BANK AL-MAGHRIB - Cours de référence' />
<webctrl tag='TABLE' />
<webctrl tableCol='2' tag='TD' rowName='*1 DOLLAR U.S.A.*' />
as we used the info of USD within the selector we are not bound on a particular row index
from this we receive the value as displayed on the website:
"8,9663 "
The received value we can trim and parse into a double. For doing this we do take care about the Formats and control the GroupSeperator character and the decimal character:
So we can parse the string into a double:
Later we can use the Double and get a string from it with ToString. As the format is already as we do need we do not have to reformat it. Otherwise we would take control similar as we had done for the parsing.
Kindly note: setting up a number parsing with e.g. the XXX.Parse method and providing the custom number format allows to be more reliable compared to string.replace approaches. So we do prefer
Get Text activity was exactly what I needed, but I could not be able to do it without the correct selector. I followed your instructions and it worked absolutely perfect! Also I will consider your suggestions about formats and will work on them.
Thank you very much for your time and effort, I really appreciate it. I marked it as a solution.