我是 Robotframework 的新手,我一直在尝试将测试结果导出到 excel,但我无法获得将数据写入 excel 的正确循环。逻辑的工作原理是每次元素出现在页面中时,它都会记录到控制台。但同时,我希望它用excel编写。
使用当前代码,它只是失败了,它无法识别 ${my_data}
我只是放.....来代表没有提到的代码。
*** Test Cases ***
Check data of the web
Open browser ${url} chrome
: FOR ${url} IN @{url_list}
\ Go To ${url}
\ ${searched_script} = Get Source
\ Run Keyword And Continue On Failure Should Contain ${searched_script} ${sample}
\ Log to Console ${url}
\ @{site_data} = Get WebElements
\ Loop data @{site_data}
\ Push all result to excel
Close Browser
*** Keywords ***
Loop data
[Arguments] @{site_data}
: FOR ${site_data} IN @{site_data}
\ Log ${site_data}
\ ${my_data}= Get Element Attribute ${site_data} my_data_sample
\ Continue For Loop If $my_data is None
\ Run Keyword And Continue on Failure Should Contain ${my_data} hello_world
\ Log To Console ${my_data}
Push all result to excel
Create excel document doc_id=docname
Write excel rows 1 0 @{my_data} sheet #my_data here is not passing the data from the loop
Save Excel Document test.xlsx