How can I send key chords to text area with Selenium?

前端 未结 5 1231
天涯浪人
天涯浪人 2021-01-02 03:42

I would like to simulate a user pressing shift-enter in a text area. Here is the code I am working with:

var driver = new FirefoxDriver();
driver.Navigate().         


        
5条回答
  •  醉酒成梦
    2021-01-02 04:11

    Simpler than I expected. Since SendKeys takes a string, and the static constants on Keys are all strings they can simply be concatenated together like this:

    textarea.SendKeys(Keys.Shift + Keys.Enter);
    

提交回复
热议问题