我正在使用BDD和Gherkin设计场景。我正在与量角器一起工作。参数之一是按钮的定位器。 尝试使用定位器查找按钮时,找不到此类按钮。请参阅下面的功能以更好地了解:
def getHistoricData(symbols, delay=0.5, **options):
'''
get data from Yahoo finance and return pandas dataframe
Will get OHLCV data frame if sinle symbol is provided.
If many symbols are provided, it will return a wide panel
Parameters
------------
symbols : str or list
Yahoo finanance symbol or a list of symbols
sDate : tuple (optional)
start date (y,m,d)
adjust : bool
T/[F] adjust data based on adj_close
Returns
---------
DataFrame, multi-index
'''
assert isinstance(symbols,(list,str)), 'Input must be a string symbol or a list of symbols'
if isinstance(symbols,str):
return getSymbolData(symbols,**options)
else:
data = {}
print('Downloading data:')
p = ProgressBar(len(symbols))
for idx,symbol in enumerate(symbols):
p.animate(idx+1)
data[symbol] = getSymbolData(symbol,verbose=False,**options)
sleep(delay)
return pd.concat(data,axis=1, names=['symbol','ohlcv'])
代码是:
Scenario Outline: main page of the application works, and when clicking on the button, the page is opened
When open main page of the application
And select the <button>
Then application is running
Examples:
|button|
|'[href="/template_definition"]'|
该步骤是上面的步骤。现在,下面是我要选择其css定位符包含在“ button”变量中的元素的代码。问题是,我应该在写“按钮”一词的地方写什么才能使它起作用。
When(/^select the (.*)/, function (button,callback)
{
HomePage.clickButton(button,callback);
});
答案 0 :(得分:0)
删除'
附近的[href="/template_definition"]
,默认情况下,step参数将被视为字符串。因此,无需将定位器放在'