1

I am using RobotFramework in Python to automate an application on macOS Chrome browser. I need to send multiple keypresses to scroll my grid to right but with no luck.

I tried using .sendKeys():

from selenium.webdriver.common.keys import Keys 
from selenium.webdriver.common.action_chains import ActionChains
ActionChains(self._current_browser()).send_keys(Keys.ARROW_RIGHT).perform()

I have read that sendKeys() doesn't work with macOS. What can be the alternative?

Blaszard
  • 30,954
  • 51
  • 153
  • 233
  • ActionChains(self._current_browser()).key_down(Keys.ARROW_RIGHT).key_down(Keys.ARROW_RIGHT).key_up(Keys.ARROW_RIGHT) try something like this. – cruisepandey May 18 '18 at 14:44
  • 3
    What happens when you run that code? Do you get errors? If so, what errors? If no errors, what happens? Do the wrong keys get sent? Do they get sent to the wrong place? – Bryan Oakley May 18 '18 at 15:23
  • `ActionChains` sends the key to the current focused element when it's not given (your case), while SeleniumLibrary's `Press Key` and selenum's `element.send_keys()` - to a specific target. Are you sure the focus is correct when your code is ran? And address Bryan Oakley's request for more information, the question in its current form is of low quality. – Todor Minakov May 19 '18 at 04:26
  • @BryanOakley I get an error which says no browser is open and it breaks my tests. – conscious_breather May 21 '18 at 14:09
  • If you're getting "no browser open", then the problem isn't with `send_keys`, the problem is with the fact that you don't have an open browser. – Bryan Oakley May 21 '18 at 14:19

0 Answers0