亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 Robot Framework 從 Python 中的方法返回值

使用 Robot Framework 從 Python 中的方法返回值

慕碼人8056858 2021-06-30 17:42:46
所以可以說我在python中有這個方法def get_data(notificaition):    print("Notification Recived: ", notificaition)然后我有另一種方法可以接收事件并獲取該事件的值。def verify_singal_r():    with Session() as session:        connection = Connection("http://example/signalr", session)        print(connection)        logging.info("got the connection")        presenceservice = connection.register_hub('MyHub')        connection.start()        def print_error(error):            print('error: ', error)        connection.error += print_error        # TODO: NEED TO ADD POST REQUEST HERE        presenceservice.client.on('Notified', get_data)        connection.wait(10)一旦關鍵字Verify_Signal運行,我就會得到我需要的值并將它們打印到控制臺上如何使用get_data機器人框架中的值?我試著簡單地使用*** Test Cases ***Get Event Back     verify_singal_r     get_data但這不起作用,因為 get_data 需要參數。
查看完整描述

2 回答

?
料青山看我應如是

TA貢獻1772條經驗 獲得超8個贊

你的職能


def get_data(notificaition):

    print("Notification Recived: ", notificaition)

期待爭論


但是,當您在機器人框架中調用它時


*** Test Cases ***


Get Event Back

     verify_singal_r

     get_data

你沒有提供任何論據。


你可以試試這樣的


*** Variables ***

${notification}    Test

*** Test Cases ***


Get Event Back

     verify_singal_r

     get_data    ${notification}

這將解決您的問題。


查看完整回答
反對 回復 2021-07-06
?
縹緲止盈

TA貢獻2041條經驗 獲得超4個贊

你的方法


def get_data(notificaition):

    print("Notification Recived: ", notificaition)

不返回任何內容,因此機器人框架關鍵字也不會返回任何內容。


查看完整回答
反對 回復 2021-07-06
  • 2 回答
  • 0 關注
  • 230 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號