javascript - “API 命令登录表单”中的无效元素状态
问题描述
我是 Selenium Webdriver 的新手
我试过这段代码
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();
当我用谷歌浏览器的控制台测试选择器时,它起作用了!但是当我尝试使用硒时,它显示了这个错误
[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
谁能帮我这个?谢谢!
解决方案
推荐阅读
- android - 使用 API 数据更新小部件的 TextView
- python - 为什么按钮小部件的命令属性在 Tkinter 中无法按预期工作?
- list - 访问 dart 中的嵌套对象列表
- c++ - 如何在 C++ 项目中包含 Boost 作为 CMake 项目中的 Git 子模块?
- python - python:线程和 GIL
- android - Android Studio - OpenCV 项目不会构建
- r - if else 使用过滤器 R
- javascript - 对象被推送到数组后发生变化
- azure - 如何确保文件在发布到 Azure 时得到更新?
- vue.js - 在 Vue 3 的插件中创建全局计算属性