Basically I'm looking for a way to send a CTRL + A to a div on a webpage in a Selenium/Perl environment. It seems like other language drivers have a "chord" function to do it, but the Perl module doesn't have that so far as I can see. Any ideas?
Asked
Active
Viewed 191 times
0
-
1[This answer](http://stackoverflow.com/a/11509778/176646) to a similar question from a couple of years ago states that there isn't a `chord` function in the Ruby bindings either, but that you can simulate it with key presses. I'm guessing you can adapt that solution to Perl. – ThisSuitIsBlackNot Sep 04 '14 at 14:16
-
Couldn't find a way to do it in the end. Used AutoIt to get the functionality. Such shame. – sir_gelato Sep 05 '14 at 03:20
1 Answers
0
You could use Selenium::Remote::Driver like:
# include the WDKeys module
use Selenium::Remote::WDKeys;
.
.
$driver->send_keys_to_active_element(KEYS->{'space'}, KEYS->{'enter'});
There's also send_modifier method which sends an event to the active element to depress or release a modifier key. So that you could do something as:
$driver->send_modifier('Alt','down');
$elem->send_keys('c');
$driver->send_modifier('Alt','up');

Chankey Pathak
- 21,187
- 12
- 85
- 133