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:
    • "Open browser", "Close browser" from the "Browsers" action group;
    • "Open", "Save", "Close" from the "Excel" action group;
    • "For" from the "Base actions" group.

    Example:

  2. Fill in the action parameters:
    1. Open Browser action - 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. Close Browser action - context browser.

    3. Open action - in the "File Path" parameter, specify the path to the Excel file.

    4.  "Save" and "Close" actions - in the "Context" parameter, specify the previously opened Excel file.

    5. For action:

    • "From" - 1;
    • "To" - 5;
    • "Increment" - 1.
  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 String data type 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. Convert data action:

      Source parameter - the state of the loop iterator "For"; Type parameter - "String".

      Example:

    2. Get Customer action:
      Context parameter - instance of the previously opened browser; Element parameter - the web element to be created.
      Example:

To create a web element, follow these steps:

  1. Select the Add new resource as the method of filling the parameter.

  2. Fill in the Display name parameter (with the "Element") and Default attribute parameter by choosing "XPath" from the dropdown list.

  3. Click the "Save" button.

  4. In the Replace by Pattern action specify:

    • Text parameter - the previously created variable "Customer XPath";

    • Pattern parameter - the word "CUSTOMER" to be replaced;

    • Substitution parameter - the result of the action "Convert Data".

    Parameter "Result" - XPath of the web element "Customer".
  5. In the Set cell value action, specify:
    • Context parameter - the instance of the opened Excel file;
    • Row of the cell parameter - use the expression builder tool to fill this parameter;
    Use the "Connect" action from the "Text" group to connect the column number "A" and the row number equal to the loop iterator state. Since text values are connected, specify the result of the "Data conversion" action. Требуется замена скриншота


    The "Value" parameter is the result of the "Get text" action. Требуется замена скришота

    XP22.png
  6. Launch the robot.

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

  • Нет меток