web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / LEZ Compliant vehicle ...
Power Automate
Answered

LEZ Compliant vehicle check

(0) ShareShare
ReportReport
Posted on by 16

Hi all,

 

I am trying to create a desktop flow, that opens https://www.lowemissionzones.scot/vehicle-registration-checker

and takes registration from each row of a table to input into a field on that website.

GalinZ_0-1709734748010.png

I am trying to

-> copy the reg from a cell

->then paste on the website

-> then click "submit"

-> click "yes"

->copy the result

-> paste the result on adjacent cell

->go to next row and do the same

 

When I try to capture actions, it records clicking on cell A2 for example but I cannot after that convert A2 into a variable, which to increase to A3, etc.

 

I did try read from CSV file function and adding it into a table, but then I am not sure how to proceed further.

 

Can you please help or give me some directions?

 

Thanks in advance

 

 

Regards,

Galin

 

 

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @GalinZ 

    Please follow suggested approach.

    1. Launch Chrome and Navigate to URL:

    2. Read Data from CSV File:

      • It reads data from a CSV file located at "C:\Users\OneDrive\Documents\Vechicle_Reg.csv".
      • The CSV file is encoded in UTF-8 format.
      • It trims fields and assumes the first line contains column names.
      • The data read from the CSV file is stored in a variable called CSVTable.
    3. Loop Through Each Row in CSVTable:

      • It iterates over each row in the CSVTable variable.
      • Inside the loop, it performs various actions for each row.
    4. Wait for Web Page Content:

      • It waits for a specific element to load on the webpage.
      • The element is identified by its CSS selector.
    5. Populate Text Field:

      • It simulates keyboard inputs by sending arrow key down strokes multiple times(Sometimes its failed so I added this).
      • It populates a text field on the webpage with the data from the first column of the current row.
    6. Select Radio Button:

      • Depending on the value in the second column of the current row (UK or not), it selects a radio button on the webpage.
    7. Press Button:

      • It clicks on the "SUBMIT" button on the webpage.
    8. Extract Data from Web Page:

      • It extracts data from a specific section of the webpage using CSS selectors.
      • The extracted data is stored in a datatable variable called DataFromWebPage.
    9. Modify DataTable Items:

      • It updates the CSVTable with the extracted data.
      • It updates the "Make", "Model", and "Colour" columns of the current row with the extracted values.
    10. Increment Counter and Loop:

    • It increments the Counter variable by 1 for each iteration.
    • The loop continues until all rows in the CSVTable have been processed.
    1. Write Data to CSV File:
    • It writes the updated CSVTable data to a new CSV file located at "C:\Updated_vechicle_Data.csv".
    • It does not include column names in the output file.
    • If the file already exists, it overwrites it.

    Deenuji_0-1709786003943.png

     

     

    Code:

     

     

     

     

     

    WebAutomation.LaunchChrome.LaunchChrome Url: $'''https://www.lowemissionzones.scot/vehicle-registration-checker''' WindowState: WebAutomation.BrowserWindowState.Maximized ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
    File.ReadFromCSVFile.ReadCSV CSVFile: $'''C:\\Users\\deenu\\OneDrive\\Documents\\Vechicle_Reg.csv''' Encoding: File.CSVEncoding.UTF8 TrimFields: True FirstLineContainsColumnNames: True ColumnsSeparator: File.CSVColumnsSeparator.SystemDefault CSVTable=> CSVTable
    SET Counter TO 0
    LOOP FOREACH CurrentItem IN CSVTable
     WAIT (WebAutomation.WaitForWebPageContent.WebPageToContainElement BrowserInstance: Browser Control: appmask['Web Page \'h ... on-checker\'']['Input text \'vrn\' 2'])
     MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}{Down}''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: False
     WAIT 5
     WebAutomation.PopulateTextField.PopulateTextFieldUsePhysicalKeyboard BrowserInstance: Browser Control: appmask['Web Page \'h ... on-checker\'']['Input text \'vrn\''] Text: CurrentItem[0] Mode: WebAutomation.PopulateTextMode.Replace UnfocusAfterPopulate: True WaitForPageToLoadTimeout: 60
     IF CurrentItem[1] = $'''UK''' THEN
     WebAutomation.SelectRadioButton.SelectRadioButton BrowserInstance: Browser Control: appmask['Web Page \'h ... on-checker\'']['Input radio \'origin\''] WaitForPageToLoadTimeout: 60
     ELSE
     WebAutomation.SelectRadioButton.SelectRadioButton BrowserInstance: Browser Control: appmask['Web Page \'h ... on-checker\'']['Input radio \'origin\' 2'] WaitForPageToLoadTimeout: 60
     END
     WebAutomation.PressButton.PressButton BrowserInstance: Browser Control: appmask['Web Page \'h ... on-checker\'']['Button \'SUBMIT\''] WaitForPageToLoadTimeout: 60
     WebAutomation.ExtractData.ExtractList BrowserInstance: Browser Control: $'''html > body > section > div > div > div > section > aside:eq(1) > div:eq(1) > div''' ExtractionParameters: {[$'''span''', $'''Own Text''', $''''''] } PostProcessData: False TimeoutInSeconds: 60 ExtractedData=> DataFromWebPage
     Variables.ModifyDataTableItem DataTable: CSVTable ColumnNameOrIndex: $'''Make''' RowIndex: Counter Value: DataFromWebPage[0][0]
     Variables.ModifyDataTableItem DataTable: CSVTable ColumnNameOrIndex: $'''Model''' RowIndex: Counter Value: DataFromWebPage[1][0]
     Variables.ModifyDataTableItem DataTable: CSVTable ColumnNameOrIndex: $'''Colour''' RowIndex: Counter Value: DataFromWebPage[2][0]
     Variables.IncreaseVariable Value: Counter IncrementValue: 1
    END
    File.WriteToCSVFile.WriteCSV VariableToWrite: CSVTable CSVFile: $'''C:\\Deenu\\Updated_vechicle_Data.csv''' CsvFileEncoding: File.CSVEncoding.UTF8 IncludeColumnNames: False IfFileExists: File.IfFileExists.Overwrite ColumnsSeparator: File.CSVColumnsSeparator.SystemDefault

     

     If my response addresses your concern, please consider marking it as the solution  and giving it a thumbs upThis helps others in the future and also serves as motivation for me. Thank you!

  • Verified answer
    VishnuReddy1997 Profile Picture
    2,656 Super User 2026 Season 1 on at

    @GalinZ 

     

    I have attached screenshots of the flow. Please check and if it works. Mark it as solution.

    Vehicle Part 1.pngVehicle Part 2.pngVehicle Part 3.png

  • GalinZ Profile Picture
    16 on at

    Thank you so much @Deenuji .

     

    I wasn't sure where to add the code as I am new to this.

    Your solution helps me a lot, as I will be using it for similar project.

     

    BIG THANKS!

     

    Much appreciated for the prompt response.

    You are really making a difference in the Power Automate Community.

     

    Regards,

    Galin

  • GalinZ Profile Picture
    16 on at

    Thank you so much @VishnuReddy1997 

     

    I tried it and it works perfect.

    There was another solution with a code, but I wasn't sure where to add it.

    While following your steps I also learned a lot and will be using this way of creating a desktop flows.

     

    Much appreciated for the prompt response.

    You are really making a difference in the Power Automate Community.

     

    Regards,

    Galin

  • Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @GalinZ 

    I am referring normal copy/pate only. Below attached how its works.

    Deenuji_0-1709807024432.png

    Deenuji_1-1709807084925.png

     

    The above code will not work 100% so please recapture all your UI elements once again wherever you seeing some errors.

     

    ------------------------------------------------------------------------------------------------------------------------

    If my response addresses your concern, please consider marking it as the solution  and giving it a thumbs up.

    This helps others in the future and also serves as motivation for me. Thank you!

     

  • GalinZ Profile Picture
    16 on at

    Oh my,

     

    I haven't realised I can paste the code right in the steps window.

     

    Thanks a lot @Deenuji .

     

    Will definitely use this.

     

    Kind regards

    Galin

     

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @GalinZ 

    If my response addresses your concern, please consider marking it as the solution  and giving it a thumbs upThis helps others in the future and also serves as motivation for me. Thank you!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 535

Last 30 days Overall leaderboard