Open url, login, copy text, save, loop

hi, can you help me with this task. it goes like this

  1. login to website
  2. scrape text data
  3. save to csv
  4. go to next site
  5. loop

my code but too long

{
  "Name": "sales",
  "CreationDate": "2022-8-16",
  "Commands": [
    {
      "Command": "open",
      "Target": "website1",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=username",
      "Value": "admin",
      "Targets": [
        "id=username",
        "name=email",
        "xpath=//*[@id=\"username\"]",
        "xpath=//input[@id='username']",
        "xpath=//input",
        "css=#username"
      ],
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=password",
      "Value": "admin",
      "Targets": [
        "id=password",
        "name=pswd",
        "xpath=//*[@id=\"password\"]",
        "xpath=//input[@id='password']",
        "xpath=//input[2]",
        "css=#password"
      ],
      "Description": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "id=loginBtn",
      "Value": "",
      "Targets": [
        "id=loginBtn",
        "xpath=//*[@id=\"loginBtn\"]",
        "xpath=//button[@id='loginBtn']",
        "xpath=//button",
        "css=#loginBtn"
      ],
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "id=ipAddress",
      "Value": "!csvLine",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "id=lifeCoinCount",
      "Value": "!csvLine",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "website2",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=username",
      "Value": "admin",
      "Targets": [
        "id=username",
        "name=email",
        "xpath=//*[@id=\"username\"]",
        "xpath=//input[@id='username']",
        "xpath=//input",
        "css=#username"
      ],
      "Description": ""
    },
    {
      "Command": "type",
      "Target": "id=password",
      "Value": "admin",
      "Targets": [
        "id=password",
        "name=pswd",
        "xpath=//*[@id=\"password\"]",
        "xpath=//input[@id='password']",
        "xpath=//input[2]",
        "css=#password"
      ],
      "Description": ""
    },
    {
      "Command": "clickAndWait",
      "Target": "id=loginBtn",
      "Value": "",
      "Targets": [
        "id=loginBtn",
        "xpath=//*[@id=\"loginBtn\"]",
        "xpath=//button[@id='loginBtn']",
        "xpath=//button",
        "css=#loginBtn"
      ],
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "id=ipAddress",
      "Value": "!csvLine",
      "Description": ""
    },
    {
      "Command": "storeText",
      "Target": "id=lifeCoinCount",
      "Value": "!csvLine",
      "Description": ""
    },
    {
      "Command": "csvSave",
      "Target": "CoinCount.csv",
      "Value": "",
      "Description": ""
    }
  ]
}