It’s not really a problem, more a matter of choice how you want to manage your data.
When you say you want to use an array, do you mean a list or a dictionary, python has both types and so Robot Framework inherits both, for now I’ll assume you are not talking about a c style character array (string) or a byte array.
So for the simplest example, with a simple list you can just use the builtin Create List and pass the list you created directly to your add device keyword. but what if the developer adds a new field?
So using Create Dictionary might be a better choice, then you can key value pairs where the keys match the field names so if a new field is added it’ll be easier to maintain your tests
That answers the question for creating 1 device, for multiple devices you can simply copy your first test with the Create Dictionary and add device keywords, change the data in the dictionary and now you have a second test to add a second device, if you only have a few test cases that might be all you need.
If you have a lot of test cases that test many permutations of add device then you might want to use an external data file, like the builtin Variable files with python or YAML or even the datadriver library
As I said at the beginning it’s your choice how you want to manage your data, Robot Framework gives you many options so you can choose what works best for you.
Hii @damies13
now I got some idea
but, some confusion in this page,
when I am clicking add device button
one new pop-up window will open, then need to give input and some options need to select
then click on save button
one row is going to be created
I was not able to download that file, please post the relevant section (not the whole file) inside a code block (use ``` on a line by itself at the start and end of the code block)
But as I mentioned you first need to decide which strategy you want to use, you didn’t mention which one you choose?
${Length} ${0}
*** Test Cases ***
Valid_loginpage
Open Browser to the login RTU2000 page
FOR ${portNumber} IN RANGE 1 3
Validate Modbus Config Options ${portNumber}
END
#[Teardown] Close Browser
*** Keywords ***
Open Browser to the login RTU2000 page
Open Browser http://192.168.101.103/#/ chrome
Maximize Browser Window
Input Text Name=username Admin
Input Text Name=password softel123
Click button Login
Sleep 10
Validate Modbus Config Options
[Arguments] ${portNumber}
Log To Console Port = ${portNumber}
${elementId}= Set Variable sidebarModbus${portNumber}BTN
Log To Console ${elementId}
Click Element sidebarModbus${portNumber}BTN
Sleep 3s
Wait Until Element Is Visible id=modBaudrateVAL timeout=3
${OptionList} = Get List Items id=modBaudrateVAL
Log To Console ${OptionList}
Log To Console ${Baud Rate LIST}
Lists Should Be Equal ${OptionList} ${Baud Rate LIST}
Wait Until Element Is Visible id=modstopbitsVAL timeout=3
${OptionList} = Get List Items id=modstopbitsVAL
Log To Console ${OptionList}
Log To Console ${Stop Bits LIST}
Lists Should Be Equal ${OptionList} ${Stop Bits LIST}
Wait Until Element Is Visible id=moddatabitsVAL timeout=3
${OptionList} = Get List Items id=moddatabitsVAL
Log To Console ${OptionList}
Log To Console ${Data Bits LIST}
Lists Should Be Equal ${OptionList} ${Data Bits LIST}
Wait Until Element Is Visible id=modpartityVAL timeout=3
${OptionList} = Get List Items id=modpartityVAL
Log To Console ${OptionList}
Log To Console ${Partity LIST}
Lists Should Be Equal ${OptionList} ${Partity LIST}
#Add Device
FOR ${Index} IN RANGE 2 4
Click Element id=deviceaddBTN
Sleep 1s
${Length}= set variable ${Length+1}
Log To Console Length: ${Length}
Wait Until Element Is Visible id=device_selectedStatusTXT timeout=3
${OptionList} = Get List Items id=device_selectedStatusTXT
Log To Console ${OptionList}
Log To Console ${Device Status LIST}
Lists Should Be Equal ${OptionList} ${Device Status LIST}
Click Element id=device_selectedStatusTXT
Select From List By Value id=device_selectedStatusTXT 1
Click Element id=device_deviceNameTXT
Input Text id=device_deviceNameTXT MET_${Index}
Click Element id=device_deviceLocationTXT
Input Text id=device_deviceLocationTXT LOC_${Index}
Click Element id=device_slaveAddSelectedTXT
Input Text id=device_slaveAddSelectedTXT ${Index}
Click Element id=device_ResTimeoutTXT
Input Text id=device_ResTimeoutTXT 2
Click Element id=device_deviceRetriesTXT
Input Text id=device_deviceRetriesTXT 10
Click Element id=periodicityDwnVal
${OptionList} = Get List Items id=periodicityDwnVal
Log To Console ${OptionList}
Log To Console ${Periodicity LIST}
Lists Should Be Equal ${OptionList} ${Periodicity LIST}
Click Element id=periodicityDwnVal
Select From List By Value id=periodicityDwnVal 20
Sleep 2s
Click Element id=deviceSaveBTN
Sleep 2s
END
${Length}= set variable ${Length+1}
Log To Console Length: ${Length}
#Validating…
FOR ${RowRange} IN RANGE 2 4
${Rows}= get element count Xpath=//[@id=“devicetableListid”]/tbody/tr #Counting No.of rows
${Columns}= get element count Xpath=//[@id=“devicetableListid”]/tbody/tr[${RowRange}]/td #Counting No.of columns
Log To Console No.Of ROWS = ${Rows}
Log To Console No.Of COLUMNS = ${Columns}
FOR ${Inbox} IN RANGE 1 10
${Data}= get text Xpath=//*[@id="devicetableListid"]/tbody/tr[${RowRange}]/td[${Inbox}] #Get Data
Log To Console ${Data}
END
table column should contain Xpath=//*[@id="devicetableListid"] 7 10 #Validation
table row should contain Xpath=//*[@id="devicetableListid"] 2 2
table cell should contain Xpath=//*[@id="devicetableListid"] 3 1 2 #Cell Validation
table cell should contain Xpath=//*[@id="devicetableListid"] 3 2 Enable
table cell should contain Xpath=//*[@id="devicetableListid"] 3 3 MET_2
table cell should contain Xpath=//*[@id="devicetableListid"] 3 4 LOC_2
table cell should contain Xpath=//*[@id="devicetableListid"] 3 5 2
table cell should contain Xpath=//*[@id="devicetableListid"] 3 6 2
table cell should contain Xpath=//*[@id="devicetableListid"] 3 7 10
table cell should contain Xpath=//*[@id="devicetableListid"] 3 8 20
table cell should contain Xpath=//*[@id="devicetableListid"] 4 1 3 #Cell Validation
table cell should contain Xpath=//*[@id="devicetableListid"] 4 2 Enable
table cell should contain Xpath=//*[@id="devicetableListid"] 4 3 MET_3
table cell should contain Xpath=//*[@id="devicetableListid"] 4 4 LOC_3
table cell should contain Xpath=//*[@id="devicetableListid"] 4 5 3
table cell should contain Xpath=//*[@id="devicetableListid"] 4 6 2
table cell should contain Xpath=//*[@id="devicetableListid"] 4 7 10
table cell should contain Xpath=//*[@id="devicetableListid"] 4 8 20
table cell should contain Xpath=//*[@id="devicetableListid"] 5 1 4 #Cell Validation
table cell should contain Xpath=//*[@id="devicetableListid"] 5 2 Disable
table cell should contain Xpath=//*[@id="devicetableListid"] 5 3 MET_11
table cell should contain Xpath=//*[@id="devicetableListid"] 5 4 LOC_22
table cell should contain Xpath=//*[@id="devicetableListid"] 5 5 64
table cell should contain Xpath=//*[@id="devicetableListid"] 5 6 6
table cell should contain Xpath=//*[@id="devicetableListid"] 5 7 3
table cell should contain Xpath=//*[@id="devicetableListid"] 5 8 30
END
Need to create array for store the input data for validation …
I use table cell should contain keyword
just you look at this code
Header row of table is no need to change
remaining rows need to modified…
My “hot take” for something like this - either create a CSV file for the values you want or store the values in a DB and read them in at runtime. You could do the latter without writing any non-Robot code, but the former will require a bit of Python.