How can we pass different browser at once in robotframework

后端 未结 2 1399
再見小時候
再見小時候 2021-02-14 14:41
*** Variables ***

${BROWSER}          firefox
${URL}              http://url/
${Delay}            0  

in my settings.txt file i have a variable named

2条回答
  •  你的背包
    2021-02-14 15:07

    Ok I think I've solved this problem by writing a simple script.

    I Just wrote a program which will read the file settings.txt and find the line @{BROWSER} firefox chrome IE and then extract browsers name and store into a list . so this script will return a List something like this ['firefox', 'chrome', 'IE']

    now instead of using single pybot command I'll use it in a Loop

    for browser in browsers:
            call(['pybot','--variable'] +['BROWSER:%s'%browser] + test_args) 
    

    settings.txt file will contain two variable

    ${BROWSER}          firefox      #So default browser is firefox. you can leave it blank
    @{BROWSERS}         firefox  chrome  IE
    

提交回复
热议问题