How to fill out excel on the web and automatically jump to the next line in uipath

Hello ,
I’m doing an exercise to get data from Excel to fill in the web, and I’ve executed the last paragraph to fill in, but when I add a new line, it can’t automatically fill in that new line.
I have filled in the first line. But when a new line appears, it continues to fill in the first line.
Sorry about my bad English.
I need your help, thank you.

Hi @phuc_trinh

After click on Add give some delay

Regards,

1 Like

Hi @phuc_trinh

This was the selectors issue. When you are indicating with Type into activity on the first line it was taking only first line selectors. After you are adding new line, the type into activity selectors is in first line only that’s why it was entering in the same line. For this case, you have to fine tune the selectors to make it dynamic.

Fine tuning means we have to find a attribute which number is keep changing for the first, second or other lines. We have to create count variable and pass it to the attribute when iterating through each row in excel we have to increment the count value then the selectors also change it will enter in the next lines for every row execution.

Hope you understand!!

Can you help me clarify, I’m really new to this UiPath. As shown, when I add a line, it still tries to repeat the first line. I don’t know how to fine-tune it.
image

I have a problem when the excel file has many lines and when filling in the web it only understands the first line when a new line appears and cannot enter the new line.

Hi @phuc_trinh ,

It sounds like your automation might be stuck on the first row and not iterating through the subsequent rows.

Here is a general approach to ensure that your automation fills in each new row from Excel correctly:

  1. Read Excel Data:
  • Use the “Read Range” activity to read the entire data table from Excel into a DataTable variable.
  1. For Each Row:
  • Use the “For Each Row” activity to iterate through each row in the DataTable.
  1. Type Into / Fill Web Form:
  • Within the “For Each Row” loop, use the “Type Into” or other relevant activities to fill in the web form using the data from the current row.

Here’s a step-by-step guide:

  1. Read Range:
  • Add an “Excel Application Scope” activity.
  • Inside the scope, use a “Read Range” activity to read the data from the Excel file into a DataTable variable, e.g., dtData.
  1. For Each Row:
  • Add a “For Each Row” activity and set the DataTable property to dtData.
  • Inside the loop, use the following approach to fill the form:

UiPath

  1. Selectors and Dynamic Elements:
  • Make sure your selectors are dynamic enough to handle different rows if the web form has any dynamic IDs or attributes. Use UiPath’s “UiExplorer” to fine-tune your selectors.
  • If the web form requires scrolling or navigation to new rows, ensure that those actions are incorporated into your loop.

Regards
Sandy

1 Like

I am very grateful to you for explaining it carefully to me. But I’m stupid because I can’t understand step 3: Selectors and Dynamic Elements. Because when I click to add a new line it jumps to the bottom.
Hope you help me.

Understanding Dynamic Selectors

Dynamic selectors are essential when dealing with web forms where element IDs or attributes change. Here’s a way to handle this:

  1. Open UiExplorer:
  • Use UiExplorer to inspect the elements on your web form.
  • Identify the attributes that remain constant even when you add a new line.
  1. Modify Selectors Dynamically:
  • When you capture a selector, it might look something like this:

plaintext

Copy code

<html app='chrome.exe' title='Your Web Form'>
  <webctrl id='input1' tag='INPUT' />
</html>
  • If the id changes dynamically, look for other stable attributes such as name, class, or relative positioning.
  1. Use Wildcards:
  • Replace dynamic parts with wildcards (*). For example:

plaintext

Copy code

<html app='chrome.exe' title='Your Web Form'>
  <webctrl id='input*' tag='INPUT' />
</html>
  1. Variables in Selectors:
  • You can use variables within your selectors to make them more flexible. For example:

plaintext

Copy code

<html app='chrome.exe' title='Your Web Form'>
  <webctrl id='input{{rowNumber}}' tag='INPUT' />
</html>
  • Here, rowNumber is a variable that you can increment within your loop.

Handling Form Scrolling or Navigation

  1. Scroll Activities:
  • Use activities like Send Hotkey (e.g., PageDown) or Scroll to ensure the form field is visible.
  • This might look like:

plaintext

Copy code

<Send Hotkey>
  Key: "PageDown"
</Send Hotkey>
  1. Anchor Base Activity:
  • Use Anchor Base if the field you need to interact with is consistently located near a label or other identifiable element.
  • Set the anchor to a static element and the action to the dynamic field.

Putting It All Together

Imagine you are filling out an online art gallery submission form where each new entry requires you to scroll down. Here’s a practical example:

  1. For Each Row Loop:

plaintext

Copy code

For Each Row in dtData
  Assign: currentRow = row
  1. Dynamic Selectors and Scrolling:

plaintext

Copy code

<For Each Row in dtData>
  <Send Hotkey>
    Key: "PageDown"
  </Send Hotkey>
  <Type Into>
    Selector: "<html app='chrome.exe' title='Art Gallery Form'><webctrl id='input{{rowNumber}}' tag='INPUT' /></html>"
    Text: currentRow("Title").ToString
  <Type Into>
    Selector: "<html app='chrome.exe' title='Art Gallery Form'><webctrl id='desc{{rowNumber}}' tag='TEXTAREA' /></html>"
    Text: currentRow("Description").ToString
  ...

By incorporating these dynamic elements and scrolling mechanisms, you’ll be able to fill in each new line correctly. It’s a bit like painting: sometimes you need to step back, adjust your perspective, and then add the finer details.

Regards
Sandy

1 Like

Thank you for your thorough explanation.
After I fill in each line and review where the selector is different when the new line appears like the picture, is there any way to automatically understand the change?
Hope you help me.