0
我們在嘗試傳遞存儲在var中的參數時遇到問題。 問題是,我們正在將動態獲取的div ID存儲在變量中,然後將其傳遞給.moveToObject函數。如何將動態參數傳入函數,而不是硬編碼字符串
But the function throws back error ;
Error: invalid selector: No selector specified
Wanted to know how we can pass arguments stored in variables into various functions.
For instance in the code below , we are retiring sectionId via execute , storing it in sectionId variable .
then using it later on in moveToObject.
all functions seems to work when we are giving arguments inside "" quotes, but in our case we cannot do this. Please help us out how we can achieve this.
it('drag and drop should work', function() {
var sectionId = "";
// load page, then call function()
return driver
.url('http://localhost:9000')
.pause(7000)
.click('#layoutWizardButton')
.click('#tableWizardBuild')
.pause(3000)
.execute(function() {
sectionId = window.document.getElementById('Section1');
}
.moveToObject('#ribbon-radio-tile')
.buttonDown()
.moveToObject(sectionId) -- -- > errors out here
.buttonUp()
.pause(2000)
.end()
});