Can i send KeyStroke in Selenium in Java without using a locator?
I want to send KeyStroke to WebBrowser itself, because I don't know element (and its locator), to whom I must send KeyStroke t开发者_如何转开发o perform action, which I want. But I know, that action performing correctly, when I manually select browser as active window and just press 'Enter' on the keyboard without selecting any element on the page.
I tried this code
SeleniumSession.keyPressNative(Integer.toString(KeyEvent.VK_ENTER));
but it didn't work for me.
What about sending it to the HTML element - ie find element by xpath "/html"
and sendKeys() to it?
I'd try "//body", but I'm not sure it will work in the Selenium RC API. This is one of the things that Selenium 2.x's WebDriver API was designed to make work well.
精彩评论