Can I not change header of csv file to ${} pattern?

38 Views Asked by At

This is my csv file

action,device_code,vehicle_chassis_no,vehicle_type,send_at,main_type,sub_type,company_name,model
UPDATE,HNT_002_299,FM1AKKA10313,HINO,2023-09-11 10:15:03,ad,cd,abc,0300007
UPDATE,HNT_002_557,FM1AKKA10265,HINO,2023-09-11 10:10:04,cd,ab,abc,0300007

and this is my code

*** Settings ***
Library    Selenium2Library 
Library    Collections
Library    String
Library    OperatingSystem
Library    BuiltIn
Library    Process
Resource    C:/Users/lin/Desktop/TestDLST/TestDLST.resource
Library     DataDriver  ${csv_path}   encoding=UTF-8    dialect=unix

Suite Setup         Open Browser And Login 
Suite Teardown      Close Browser

Test Template       Search Vehicle Chassis  
***Variables***
${csv_path}        C:\\Users\\lin\\Desktop\\TestDLST\\Test_Data\\dlt_example.csv   
***Keywords***

Search Vehicle Chassis
    [Arguments]     ${action}   ${vehicle_chassis_no}   ${vehicle_type}  ${device_code}  ${model}  ${main_type}  ${sub_type}    ${company_name}
    
    IF  "${action}" == "DELETE"
            Input Text   ${VehicleChassisSearch_txtbox}  ${vehicle_chassis_no}
            Click Search Button
            Sleep   5s
            Click Delete 
    END
    IF  "${action}" == "UPDATE" 
            Input Text   ${VehicleChassisSearch_txtbox}  ${vehicle_chassis_no}
            Click Search Button
            Sleep   5s
            ${nodatafound_present} =    Run Keyword And Return Status    Element Should Be Visible    xpath=//*[text()='ไม่พบข้อมูลที่ค้นหา']
            ${icon_red_circle}         Run Keyword And Return Status    Element Should Be Visible    xpath=//tr[td/text()="1"]//i[contains(@class,"zmdi zmdi-close-circle zmdi-table red")]
            Run Keyword If    ${nodatafound_present}  AND   '${action}' == 'UPDATE'   Click Add Data Button
            ...    ELSE IF    ${icon_red_circle}      Click Add Data Button         
            ...    ELSE      Click Delete Information And Create New
            Input Vehicle Chassis  ${vehicle_chassis_no}
            Select Vehicle Type     ${vehicle_type}
            Execute Javascript    document.evaluate('//button[contains(text(),"OK")]',document.body,null,9,null).singleNodeValue.click();
            Select GPS Model ID    ${model}
            Input Device Code   ${device_code}
            Input Vehicle Register Type   ${main_type}  ${sub_type}
            Input Company Name      ${company_name}
            Input Current Date
            Go Back
    END

    
***Test Cases***
Search By Using Exel    ${vehicle_chassis_no}

I want to run this code by not changing header of csv file to ${action},${device_code}... Is there any way that I can do?

0

There are 0 best solutions below