Task: Obtain the names of the first 5 procurement plans from the «Supplier Portal» website and save them in an Excel file.

Solution:

  1. Drag the following actions to the workspace:

    Example:

  2. Fill in the action parameters:
    1. Action «Open Browser» - choose «Chrome» from the drop-down list of browsers, and in the «Address» field, specify the link to the «Supplier Portal» website and navigate to the procurement plans tab. Example:

    2. Action «Close Browser» - context browser.

    3. Action «Open» - in the «File Path» parameter, specify the path to the Excel file.

    4. Actions «Save» and «Close» - in the «Context» parameter, specify the previously opened Excel file.

    5. Action «For»:

  3. Analyze the XPath of the web element:
    Compare the XPath of two consecutive procurement plans for customer information and write them to a text file. It can be observed that the only difference between them is one digit.
  4. Create a variable with the data type «String,» and the value will be the XPath of the customer, where the changing digit will be replaced with the word «Customer».
    Example:
  5. Fill the body of the loop with actions: «Convert Data» from the «Basic Actions» group, «Replace by Pattern» from the «Text» action group, «Get Text» from the «Browsers» action group, and «Set Cell Value» from the «Excel» action group.
    Example:
  6. Fill in the action parameters:
    1. Action «Convert Data»:

      Parameter «Source» - the state of the loop iterator «For»; Parameter «Type» - «String.»

      Example:

    2. Action «Get Text»:
      Parameter «Context» - instance of the previously opened browser; Parameter «Element» - the web element to be created.
      Example:

To create a web element, follow these steps:

  1. Select «Add New Resource» as the method of filling the parameter.

  2. Fill in the parameters «DisplayName,» for example, «Customer,» and «Default Attribute,» choosing «XPath» from the drop-down list.

  3. Click the «Save» button.

  4. In the action «Replace by Pattern,» specify:

    Parameter «Result» - XPath of the web element «Customer.»
  5. In the «Set Cell Value» action, specify:

    By using the «Concatenate» action from the «Text» group, combine column «A» and the row number equal to the state of the loop iterator. Since text values are combined, specify the result of the «Convert Data» action.

    Parameter «Value» - the result of the «Get Text» action.

  6. Start the robot.

  7. The result of the robot’s work is a filled Excel file.