我对webdriver和黄瓜framework.Tried非常陌生,这是我第一次在应用程序的登录屏幕上进行测试。我能够调用浏览器和网站是loaded.But i当尝试为登录字段设置值时,它抛出以下错误并中止
"Error in“执行登录:使用默认用户登录:当我使用默认用户登录时”浏览器“。$(.).setValue不是一个函数”“
我试图安装同步包,并在配置文件中将同步设置为true。无法使它工作。请帮帮忙!
这是我的配置文件
exports.config ={
//
// ====================
// Runner Configuration
// ====================
//
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
// on a remote machine).
runner: 'local',
//
path: '/wd/hub',
specs: [
'./features/*.feature'
],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
//
maxInstances: 10,
capabilities: [{
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
// grid with only 5 firefox instances available you can make sure that not more than
// 5 instances get started at a time.
maxInstances: 5,
//
browserName: 'firefox',
// If outputDir is provided WebdriverIO can capture driver session logs
// it is possible to configure which logTypes to include/exclude.
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
// excludeDriverLogs: ['bugreport', 'server'],
}],
logLevel: 'info',
sync:true,
bail: 0,
baseUrl: '********************',
//
// Default timeout for all waitFor* commands.
waitforTimeout: 10000,
//
// Default timeout in milliseconds for request
// if browser driver or grid doesn't send response
connectionRetryTimeout: 90000,
//
// Default request retries count
connectionRetryCount: 3,
services: ['selenium-standalone'],
framework: 'cucumber',
cucumberOpts: {
requireModule: ['@babel/register'],// <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
require: ['./step-definitions/*.js'], // <string[]> (file/dir) require files before executing features
backtrace: false, // <boolean> show full backtrace for errors
dryRun: false, // <boolean> invoke formatters without executing steps
//compiler: ['js:babel-core/register'],
failFast: false, // <boolean> abort the run on first failure
format: ['pretty'], // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
snippets: true, // <boolean> hide step definition snippets for pending steps
source: true, // <boolean> hide source uris
profile: [], // <string[]> (name) specify the profile to use
strict: false, // <boolean> fail if there are any undefined or pending steps
tagExpression: '', // <string> (expression) only execute the features or scenarios with tags matching the expression
timeout: 60000, // <number> timeout for step definitions
ignoreUndefinedDefinitions: false, // <boolean> Enable this config to treat undefined definitions as warnings.
},发布于 2020-04-17 22:11:11
试着执行这个简单的测试用例:
describe("webdriver.io page", () => {
it("should have the right title", () => {
browser.url('https://www.google.com');
browser.maximizeWindow();
$('input[name="q"]').setValue('some text');
});
});你能把你的测试用例发出来吗?
黄瓜例子:
When('user enters valid username', () => {
loginPage.emailAddress.addValue('some text');
});其中loginPage是一个包含emailAddress作为元素的PageObject。
发布于 2020-04-21 21:12:23
发布于 2020-04-27 19:14:30
在创建config.js .I的同时添加依赖项时,我选择了异步模式来运行命令,删除了工作区并重复了所有步骤,这次将其更改为用于运行命令的同步模式,并编写了与again.everything工作的代码相同的代码。谢谢大家的建议。
https://stackoverflow.com/questions/61280243
复制相似问题