我有这段代码获取类似Xpath的所有名称并将它们放在一个列表变量中,并将列表变量与另一个列表变量进行比较,以确保列表变量中的所有数据都匹配。现在,如果数据匹配,我需要将它放在Excel工作表中并在旁边的单元格中写入PASS,并在不匹配的值旁边显示失败。我是机器人框架的新手,请帮助。
*** Test Cases ***
Comparing data
Open Browser 1 and Collect data
Open Browser 2 and Collect data
Log Browser 1 List
Log Browser 2 List
Compare
Close allsesions of browsers
*** Keywords ***
Open Browser 1 and Collect data
${id_1}= Open Browser https://WWW.nyse.com ${Browser_1}
${count_1}= get matching xpath count //*[@id="stats"]/div/div/div[2]/div/div/div/div/div[1]
: FOR ${i} IN RANGE 2 12
\ sleep 10s
\ ${j} Get Text //*[@id="stats"]/div/div/div[2]/div/div/div/div[${i}]/div[1]
\ Append To List ${dbws_datapoints_1} ${j}
Open Browser 2 and Collect data
${id_2}= Open Browser https://WWW.nyse.com ${Browser_2}
${count_2}= get matching xpath count //*[@id="stats"]/div/div/div[2]/div/div/div/div/div[1]
: FOR ${i} IN RANGE 2 12
\ sleep 10s
\ ${j} Get Text //*[@id="stats"]/div/div/div[2]/div/div/div/div[${i}]/div[1]
\ Append To List ${dbws_datapoints_2} ${j}
Log Browser 1 List
log ${dbws_datapoints_1}
Log Browser 2 List
log ${dbws_datapoints_2}
Close allsesions of browsers
close all browsers
Compare
lists should be equal ${dbws_datapoints_1} ${dbws_datapoints_2}
答案 0 :(得分:0)
您只需要: