1

In my tests I fill the input fields (of Ant.Design https://ant.design/components/input/) with app.client.setValue( selector, value ) method. According to https://github.com/electron-userland/spectron it is supposed to be Selenium Webdriver's method. Ans it says here https://webdriver.io/docs/api/element/setValue.html the mehtod overrides the value in input. To me it always acts like addValue (meaning it sends the keys on top of the current value in the input) and I cannot find a workaround.

Resetting the input on the client just before setValue by some reason doesn't work...

 async type( selector, value ) {
      await this.app.client.execute( ( selector ) => {
        const el = document.querySelector( selector );
        // When it's INPUT_NUMBER reset is 0
        el.setAttribute( "value", el.classList.contains( "ant-input-number-input" ) ? 0 : "" );
      }, selector );
      return await this.app.client.setValue( selector, value );
  }
Dmitry Sheiko
  • 2,130
  • 1
  • 25
  • 28
  • Any new update? çi have same problem with Spectron 10 and Electron 8. The workaround is to use the Keys() functions. However, this one is not working properly in some cases. – Jesús Iglesias May 13 '20 at 07:51

0 Answers0