【问题标题】:How to set value of element?如何设置元素的值?
【发布时间】:2020-02-01 05:38:04
【问题描述】:

我想用数字填充应用程序中的元素。

从appium我知道我想填写:

element: aaa/edit_input_activation_code_first

attribute: text

value: 5 numbers eg.: 12345

我使用下面的代码在屏幕之间移动。

it("should find an element", function() {
  return driver
    .elementById('aaa/btn_registration_wizard_fragment_type_code')
    .should.eventually.exist
});


it("should find click element", function() {
  return driver
    .elementById('aaa/btn_registration_wizard_fragment_type_code')
    .click()
});  

我想用数字填充 4 个元素,然后转到下一个屏幕。

【问题讨论】:

    标签: javascript node.js appium


    【解决方案1】:

    如果您想向文本元素发送一些键,您应该使用该方法:

    let element = await driver.elementById("aaa/edit_input_activation_code_first");
    await element.type("12345")
    

    【讨论】:

      猜你喜欢
      • 2018-04-17
      • 2014-09-24
      • 1970-01-01
      • 2015-02-05
      • 2013-11-23
      • 2018-10-05
      • 2021-11-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多