0

请帮我。下面代码的输出是“[Obj obj”。

it('LeanAsset-input,function(){
    dv.sleep(5000);


    var PONum = element(by.xpath('//*[@id="pordr-create-content"]/div[1]/div[1]/div[2]/input'));

    PONum.getText().then(function (text) {
            console.log(text);
    });
    element(by.xpath('//*[@id="pordr-create-content"]/div[1]/div[2]/div[2]/input')).clear().sendKeys(PONum);

}');
4

1 回答 1

0

您正在尝试传递 web 元素而不是 sendKeys 中的文本。

您可以尝试以下两种解决方案:

it('LeanAsset-input,function(){
    dv.sleep(5000);
    var PONum = element(by.xpath('//*[@id="pordr-create-content"]/div[1]/div[1]/div[2]/input'));
    var text = PONum.getText();
    element(by.xpath('//*[@id="pordr-create-content"]/div[1]/div[2]/div[2]/input')).clear().sendKeys(text );
}');

或者

it('LeanAsset-input,function(){
    dv.sleep(5000);
    var PONum = element(by.xpath('//*[@id="pordr-create-content"]/div[1]/div[1]/div[2]/input'));
    PONum.getText().then(function (text) {
        console.log(text);
        element(by.xpath('//*[@id="pordr-create-content"]/div[1]/div[2]/div[2]/input')).clear().sendKeys(text);
    });
}');
于 2016-11-14T14:06:39.260 回答