how to use shortcuts?

31 views
Skip to first unread message

medv...@gmail.com

unread,
Mar 5, 2019, 3:50:54 AM3/5/19
to Geb User Mailing List
hi,

could please someone help me?

how can I use shortcuts like "CTRL+m" on webpages?

I tried

1: $('div.neo-layout') << Keys.chord(Keys.CONTROL, "m")
 
2: driver.findElement(By.cssSelector('div.neo-layout')).sendKeys((Keys.CONTROL + "m"))

3: WebElement element = driver.findElement(By.cssSelector('div.neo-layout'));
new Actions(driver).moveToElement(element).sendKeys(Keys.CONTROL + "m").perform();

but nothing works?

the shortcut "CTRL+m" does not depend on any page element, it should help to show a menu.

thank you for any help in advance!
Roland

Moritz Kobel

unread,
Mar 5, 2019, 6:54:22 AM3/5/19
to geb-...@googlegroups.com
Hello Roland,
In one of my tests, I have a global shortcut m, a:

Actions action = new Actions(driver)
action.sendKeys('ma').build().perform()

Does this work for you?


- Moritz


--
<\ __@ __@
\ __ _-\<, -\<,_
http://www.tandemblog.ch 0<==`-(-)/---|/-(_)

medv...@gmail.com

unread,
Mar 5, 2019, 1:01:21 PM3/5/19
to Geb User Mailing List
Hello Moritz,

I tried

Actions action = new Actions(driver)
action.sendKeys(Keys.CONTROL + "m").build().perform()

but it does not work. Any idea what's wrong? Or any other suggestions?

Thank you,
Roland

GebUser

unread,
Mar 5, 2019, 1:43:36 PM3/5/19
to Geb User Mailing List
may be it is working fine and you are not seeing anything happening.
Did it work when you manually do control + "m" ?

Trinidad Esparza

unread,
Mar 5, 2019, 8:35:52 PM3/5/19
to Geb User Mailing List
I think your selector doesn't take any inputs.
test this :

$("html") << Keys.chord(Keys.CONTROL,'m')

medv...@gmail.com

unread,
Mar 6, 2019, 4:00:20 AM3/6/19
to Geb User Mailing List
Unfortunately keyboard shortcuts do not work manually on Sauce Labs in IE11.

So that's why all the automated approaches are not working.

Does anyone have experience with Sauce Labs using IE11?

Moritz Kobel

unread,
Mar 6, 2019, 5:10:23 AM3/6/19
to geb-...@googlegroups.com
Hello Roland,

I assume the keys are combined to one string and executed one after
another.

This could help you:

action.sendKeys( Keys.chord(Keys.CONTROL, "m") ).build().perform()

source:
http://www.gebish.org/manual/current/#non-characters-e-g-delete-key-key-chords-etc


( I did not execute the code, but according to my understanding of the
documentation and API specification, this could work )


- Moritz
> --
> You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
> To post to this group, send email to geb-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/aa2705b5-ac87-404a-aa3b-d85923623e50%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages