gpt4 book ai didi

testing - 如何使用 fillIn 附加预填充的文本区域内容

转载 作者:行者123 更新时间:2023-11-28 21:24:10 25 4
gpt4 key购买 nike

我有一个文本区域,它已经使用 fillIn 函数填充了值。但现在我想在同一个文本区域中附加另一个字符“@”。但是当我再次尝试使用 fillIn 时;它重写文本区域。我怎样才能附加文本。我需要它分两步进行。

HTML:

<textarea data-test-id='descriptor'></textarea>

测试:

test('testing-fillIn', async function(assert){
await fillIn(testSelector('descriptor'), 'First text ');
await fillIn(testSelector('descriptor'), '@');
});

输出应该是:第一个文本@

最佳答案

test('testing-fillIn', async function(assert){
await fillIn(testSelector('descriptor'), 'First text ');
var textVal =document.getElementById('textArea').val();
await fillIn(testSelector('descriptor'), textVal+'@');
});
<textarea id="textArea" data-test-id='descriptor'></textarea>

关于testing - 如何使用 fillIn 附加预填充的文本区域内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44885471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com