api命令登录表单中的元素状态无效

dbf7pr2w  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(225)

我是SeleniumWebDriver的新手
我试过这个密码

const uName = $('[data-bn-type="input"]');
    uName.waitForDisplayed({ timeout: 10000 });
    uName.setValue("tomsmith@mkdsz.site");

    const pWord = $('[name="password"]');
    pWord.waitForDisplayed({ timeout: 10000 });
    pWord.setValue("SuperSecretPassword!");

    const lBtn = $('[type="flatprimary"]');
    lBtn.waitForDisplayed({ timeout: 3000 });
    lBtn.click();

当我用谷歌chrome的控制台测试seletor时,它成功了!但当我尝试使用 selenium 元素时,它显示了这个错误

[0-0] invalid element state in "API Command Login Form"
invalid element state
  (Session info: chrome=91.0.4472.124)
    at Object.getErrorFromResponseBody (E:\Automate with JS\Practice\Phan_2\node_modules\webdriver\build\utils.js:189:12)
    at WebDriverRequest._request (E:\Automate with JS\Practice\Phan_2\node_modules\webdriver\build\request.js:168:31)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Element.elementErrorHandlerCallbackFn (E:\Automate with JS\Practice\Phan_2\node_modules\webdriverio\build\middlewares.js:23:32)
    at async Element.setValue (E:\Automate with JS\Practice\Phan_2\node_modules\webdriverio\build\commands\element\setValue.js:30:5)
    at async Element.runCommandWithHooks (E:\Automate with JS\Practice\Phan_2\node_modules\@wdio\sync\build\wrapCommand.js:105:25)
    at Element.runCommandWithHooks (E:\Automate with JS\Practice\Phan_2\node_modules\@wdio\sync\build\wrapCommand.js:100:24)
    at Element.wrapCommandFn (E:\Automate with JS\Practice\Phan_2\node_modules\@wdio\sync\build\wrapCommand.js:67:44)
    at Element.elementErrorHandlerCallback (E:\Automate with JS\Practice\Phan_2\node_modules\webdriverio\build\middlewares.js:44:12)
    at Context.<anonymous> (E:\Automate with JS\Practice\Phan_2\test_scripts\LoginForm.js:9:11)    
    at Context.executeSync (E:\Automate with JS\Practice\Phan_2\node_modules\@wdio\sync\build\index.js:38:22)
    at E:\Automate with JS\Practice\Phan_2\node_modules\@wdio\sync\build\index.js:69:68

有人能帮我吗?非常感谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题