protractor: `Keys` is not defined when using `keyDown` action
When trying to create a test which checks the result of an option
+ click()
event in my app, Keys is not defined
.
This is the test being run (apologies if the JS looks malformed, it’s converted from CoffeeScript):
var driver = new webdriver.Builder()
.usingServer('http://localhost:4444/wd/hub')
.withCapabilities(webdriver.Capabilities.chrome()).build()
driver.manage().timeouts().setScriptTimeout(30000)
var ptor = protractor.wrapDriver(driver)
it('opens new tab with OPTION+click', function() {
ptor.keyDown(Keys.ALT)
.then(function() {
ptor.findElement(protractor.By.repeater('item in ses.items').row(4).column("{{item.subject}}")).click();
ptor.keyUp(Keys.ALT);
})
ptor.findElements(protractor.By.repeater('item in ses.navItems'));
.then(function(tabs) {
expect(tabs.length).toBe(1);
});
});
I’ve also tried the following variations for Keys.ALT
: ptor.driver.Keys.ALT
, ptor.driver.Key.ALT
, and Key.ALT
It’s entirely possible I’m not writing this test correctly. If that’s the case I’d appreciate any pointers in testing clicks with key modifiers.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 19 (2 by maintainers)
Maybe I am not getting it… I am trying to get one Enter click but it just doesn’t working.
I also get Keys is not defined. What is the good way of getting one enter click?