c# - Send keys to page without an input element -


on web page has keypress event listener running want able test sending keystrokes. page doesn't have input element, , calling

driver.findelement(by.xpath("//body")).sendkeys("abc"); 

throws error needing element editable accept key strokes (against chrome).

is there way generate keystrokes page sees them without injecting dummy input element?

i haven't tested mind give actions.sendkeys try?

example in c#:

// without element new actions(driver).sendkeys("abc").perform();  // send keys body new actions(driver).sendkeys(driver.findelement(by.xpath("//body")), "abc").perform(); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -