Why is React's onChange event not fired on Selenium WebDriver's SendKeys in IE 11?

后端 未结 1 1875
情歌与酒
情歌与酒 2021-02-20 15:28

We have a relatively simple React component with an input element in it:

export class MyInput extends Component {
  componentDidMount() {
    functi         


        
1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-20 16:03

    When setting the nativeEvents capability to false (which is what you’re setting with the EnableNativeEvents property), you’re telling the IE driver to use JavaScript to simulate the events. Events simulated via JavaScript cannot have the isTrusted property set to true. That property is designed to detect exactly the scenario you’re experiencing. The driver implementations for Firefox and Chrome are produced and maintained by the vendors for those browsers (Mozilla and Google, respectively), and as such, those drivers have access to internals of the browser in ways that the IE driver does not (and likely never will) have. If React is indeed keying off that property to fire the onChanged event, then the proper thing to do here is set EnableNativeEvents = true.

    0 讨论(0)
提交回复
热议问题