0

The automation framework I work with runs over multiple web applications, and some of them have keyboard shortcuts like AltGr + 2 or shift + S.

The problem we face is that to do something as simple as: element.send_keys('T') or element.send_keys('!') the shift + t or shift + 1 shortcuts get triggered. On the contrary, when something like element.send_keys('t') runs, it inputs a t as expected.

Are there any bright minds that can help me overcome this problem?

NOTE that I only saw this behavior when running my tests using PhantomJS head-less browser driver. Gecko (Firefox), Chrome, IE, Edge...they all work fine.

GabrieleMartini
  • 1,665
  • 2
  • 19
  • 26
Alejo Pane
  • 23
  • 5

1 Answers1

0

usually people ask for the reverse but checkout answers to these questions:

Send keys control + click selenium

Python - Selenium - How to use Browser Shortcuts

To send threekeys using send_keys() in selenium python webdriver

Blog looks legit: http://seleniumworks.blogspot.com/2013/09/keys-in-selenium-script-webdriver.html

Dmitry Tokarev
  • 1,851
  • 15
  • 29
  • Hi Dmitry, thank you for the links and suggestions, I've checked them all and the blog, but I actually know everything they talk about and have no issues with send_keys() method in any other driver but, for some reason PhantomJS behaves differently. I guess this is really specific and needs some deeper knowledge on the inner workings, which I sadly haven't learned just yet. – Alejo Pane Jun 13 '17 at 12:01
  • @AlejoPane yeah PhantomJS is definately not a real browser, it's just another dev tool to help run your javascript faster >> run tests faster. i'd skip those tests for PhantomJS and run them on real browsers until the solution is found. Sorry couldn't help more with this – Dmitry Tokarev Jun 13 '17 at 20:49
  • 2
    I've actually decided to log an issue on their github project, since it seems like there's absolutely no way around it. I'm currently selectively running the setup method of my tests (where data is built and text-fields are filled) with a standard browser and then switch to PhantomJS for the rest of the execution. Is not elegant, is convoluted to do, and my approach still randomly fails when changing browsers, for reasons I haven't yet identified. I'll post here when I get an answer from Aryia or any of the contributors. Thanks nonetheless Dmitry! – Alejo Pane Jun 14 '17 at 12:21