我有这段代码:
nil
我从以上例程中得到以下错误:
it('tests cookies', opts, async t => {
await driver.get(`${cdthost}/#!/my-acquisitions/${acqId}`).then(function () {
return Promise.delay(3000);
});
await driver.wait(until.elementLocated(By.id(`acq-dropdown-item-${acqId}`)), 4000).then(function () {
console.log(`acq-dropdown-item-${acqId} has been located.`);
});
let el = await driver.findElement(By.id(`acq-dropdown-item-${acqId}`));
console.log('el => ', el);
await el.click().then(() => Promise.delay(2000)).catch(function (e) {
console.error(' => Trapped click() error => ', e.stack || e);
});
return driver.getCurrentUrl().then(function (val) {
assert(val === `${cdthost}/#!/my-acquisitions/${acqId}`, 'We have a hella fast runner.');
})
.catch(function (err) {
console.error(' => Trapped getCurrentUrl() error => ', err.stack || err);
})
});
有谁知道为什么click()会产生这样的错误?这是什么意思?我该如何解决?
当我记录 => Trapped click() error => WebDriverError:
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'c8c5331543cc', ip: '172.18.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.27-moby', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.usqz3L7o9x89, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0, platformVersion=4.9.27-moby, moz:processID=445.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
Session ID: 959d0cca-24a2-4335-b6d3-a60c635cbf36
at Object.checkLegacyResponse (/usr/local/cdt-tests/node_modules/selenium-webdriver/lib/error.js:517:15)
at parseHttpResponse (/usr/local/cdt-tests/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/usr/local/cdt-tests/node_modules/selenium-webdriver/lib/http.js:441:30)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
时,我明白了:
el