Can't execute code from the exercise: web scraping

Hello all,

I hope someone can help me. I came to lesson 5 , practice 2 – web data scrapping and extracting it to Excel file.
So far all of the materials I downloaded worked, but when I came to the 5th lesson – web recording, I couldn’t run any file.

I know that the code is correct, because I downloaded it from the site and also I validated the code and it didn’t find any errors.
The code is downloaded from the training: Shopping for Laptops.xaml (8.2 KB)

I googled and searched on UIPath forum what the issue may be and I found out that I have to enable the Chrome extension, what I have done, I also installed all the packages (crtl+P and then installed and updated all). In the settings of the “attach browser” I put there Chrome as browser type, but it can’t open the browser, the same with IE and Firefox. I also tried to close the browser and run, to open it and run, to even type and to add “laptops” manually inside, but nothing. I reset browser settings, deleted all the junk inside, also nothing. The app was reinstalled - that didn’t help neither.

I checked selectors and they’re all variables, meaning that even if site changed (products on it), it shouldn’t matter for the bot. Here’s the error:

Does anyone know what the issue is? Thanks in advance.

1 Like

“Attach Browser” Activitie requires web browser already started with target page.
You can use “Open Browser” Activitie instead “Attach Browser” Activity to start browser and open target page.

Hi Honoka,

Thank you for your reply, now I don’t get the error. However, the code starts and gets executed, but nothing happens then. According to instructions, it should open a new Excel sheet and write the the extracted data, but it doesn’t happen. I created an Excel sheet named “Laptops”, but it’s still empty. Then I deleted it, so there’s no such a file on PC, but it didn’t open a new one. The code is downloaded from RPA Academy (solution for one exercise). Please, advise. Thanks a lot!

@mibajic Try once with Write Csv actvity

Can you check the number of rows in “ExtractDataTable” variable?
If rows are not there check the data extraction code else try with write range workbook, write range excel scope or csv any of them.

The rows were not visible and with range workbook it wasn’t successful either, thus I tried with WriteCSV. It works partially, it opens up a new Excel sheet! :slight_smile: however it doesn’t write in any data. In Build data Table I set up two columns and I put there integer as value.

@mibajic In the variable panel for ExtractDataTable variable remove default ie New.System.Data.DataTable

It doesn’t work without a variable, seems like

@mibajic Change data table name and check

Ok, when I open WriteCSV, I have there file path “Laptops.csv”, under it Input section, where I have data table “ExtractDatatable”. I googled about data tables and everywhere I found that data table input should be “ExtractDataTable”. Could you please explain me what did you mean by “change data table name”?
I tried with some random names, but it doesn’t take anything (btw. I used “”) except of “ExtractDataTable”.

And thank you for help. :slight_smile: This is the most important lesson for me, since I’m trying to make some automation in my job, what’s basically web scrapping and extracting data.

@mibajic In the variable panel you have ExtractDatatable variable change this ExtractDatatable to some other name

I replaced it with “variable1”, still doesn’t work, it says that variable is not declared.

Can you attach your workflow

Sure, here you go. Thanks
Shopping for Laptops.xaml (9.4 KB)

@mibajic what is the url in your workflow its attach browser

Yes, it’s attach browser. I open in Chrome and I type in manually “laptop”, as it’s a selector. And then I run the code.

@mibajic Check attached file (5.4 KB)

It works! :star_struck:
Thank you so much!

I will compare your code to mine a bit later just to see what did I do wrong and then I’ll post a comment, so other members could see what to pay attention on, when doing the same task.