这可能是一个很长的镜头,但我看到了最奇怪的事情。我正在使用来自WebdriverIO的setValue
和addValue
函数,每当我的字符串包含数字3
时,它就会被删除而不会输入到输入框中。我手动能够在这些输入中输入3
,所以我不知道发生了什么。 3
是我见过的唯一一个角色。
有什么想法吗?
更新:这只发生在Chrome
中更新2:抱歉缺乏细节。这是其他信息。我正在使用wdio测试运行器。 Safari或Firefox中不会出现此问题,仅限于Chrome。
browser.setValue(usernameInput, "t3st")
会将“tst”输入到usernameInput元素中。同样
browser.addValue(usernameInput, "t3st")
。任何包含3的字符串都将输入到任何元素,但字符串中将缺少所有3个字符串。
package.json依赖项:
"dependencies": {
"babel-preset-es2015": "~6.24.0",
"babel-register": "~6.26.0",
"chai": "~4.1.2",
"chromedriver": "^2.33.2",
"wdio-cucumber-framework": "~1.0.2",
"wdio-phantomjs-service": "~0.2.2",
"wdio-selenium-standalone-service": "~0.0.9",
"wdio-spec-reporter": "~0.1.2",
"webdriverio": "4.7.1"
},
"devDependencies": {
"babel-jest": "~21.2.0",
"babel-polyfill": "~6.26.0",
"eslint": "~4.9.0",
"eslint-config-airbnb-base": "~12.1.0",
"eslint-plugin-import": "~2.8.0",
"forever": "~0.15.3",
"http-server": "~0.10.0",
"jest": "~21.2.0"
}
答案 0 :(得分:1)
嗯,我看了一眼,但没有设法重现它。我使用using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerThings : MonoBehaviour {
public static int player_name;
void Start () {
player_name = Random.Range (10, 99);
name = player_name.ToString();
}
// Update is called once per frame
void Update () {
}
}
或chromedriver
的不同变体尝试了两个以下示例。一切都很好。
我的猜测是:
wdio-selenium-standalone-service
逻辑(表单验证)可能会截断数字; JavaScript
依赖项(package.json
)并且忘记了; WebdriverIO (npm install -g <packageName>
):
v4.8.0
WebdriverIO (> browser.setValue('*[connectqa-mya="first-name"]',"t3st t3st t3st 1234test")
{ state: 'pending' }
> [13:27:12] COMMAND POST "/wd/hub/session/29096eb4bd851d6e3a49ad740c3c1ead/elements"
[13:27:12] DATA {"using":"css selector","value":"*[connectqa-mya=\"first-name\"]"}
[13:27:12] RESULT [{"ELEMENT":"0.8157706669622329-6"}]
[13:27:12] COMMAND POST "/wd/hub/session/29096eb4bd851d6e3a49ad740c3c1ead/element/0.8157706669622329-6/clear"
[13:27:12] DATA {}
[13:27:12] COMMAND POST "/wd/hub/session/29096eb4bd851d6e3a49ad740c3c1ead/element/0.8157706669622329-6/value"
[13:27:12] DATA {"value":["t","3","s","t"," ","t","3","s","t"," ","(13 more items)"],"text":"t3st t3st t3st 1234test"}
):
v4.7.1
作为调试过程的下一步,我会:
> browser.setValue('*[connectqa-mya="first-name"]',"t3st t3st test1234 @#$%^&*")
{ state: 'pending' }
> [13:38:25] COMMAND POST "/wd/hub/session/3b621c3d7a774872cf3a37d1bec17014/elements"
[13:38:25] DATA {"using":"css selector","value":"*[connectqa-mya=\"first-name\"]"}
[13:38:25] RESULT [{"ELEMENT":"0.42949459661053613-6"}]
[13:38:25] COMMAND POST "/wd/hub/session/3b621c3d7a774872cf3a37d1bec17014/element/0.42949459661053613-6/clear"
[13:38:25] DATA {}
[13:38:25] RESULT undefined
[13:38:25] COMMAND POST "/wd/hub/session/3b621c3d7a774872cf3a37d1bec17014/element/0.42949459661053613-6/value"
[13:38:25] DATA {"value":["t","3","s","t"," ","t","3","s","t"," ","(16 more items)"]}
复制项目,看看它是否有效; dependencies
,看看使用 JavaScript / JQuery 会产生不同的结果(如果是这样,它会缩小问题的范围:不会形成 - 验证,但可能是.execute("$('<selector>').val('t3st t3st test12345');")
)。让我知道它是如何进行的,或者是否有所帮助。干杯!