[Python Selenium SafariDriver] Unable to repeat same key press event more than once

Has anyone came across with the key press event issue with safari web driver explained bellow and found any solution?


Unable to perform same key press event in safari.


  • selenium 3.0.2
  • safari 10 (using built in safari driver)
  • python 2.7.10
  • OSX 10.11.16(El Capitan)


Steps to Reproduce:

1. Install selenium 3.0.2 2.

2. Install safari 10 3.

3. Install python 2.7.10 4.

4. Try and debug the attached file.

5. Unable to press Right/Left/Up/Down key more than once using send_keys(Keys.Right) (i.e no repetitive action can be performed using key press )


Example: Unable to enter right key three times using code bellow.

driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT)
driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT)
driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT)

There is no error present, just that the second key press event is not actioned. However if another direction key is sent in the sequence then that works, but once a key direction is used then the same direction key doesn't work in the same safari driver session.

Example: if the following is executed in a sequence in a single safari driver session, then:

driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT) #Works
driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT) #Doesn't Work
driver.find_element_by_xpath("//body").send_keys(Keys.LEFT) #Works
driver.find_element_by_xpath("//body").send_keys(Keys.LEFT) #Doesn't Work

Example:

driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT) #Works
driver.find_element_by_xpath("//body").send_keys(Keys.LEFT) #Works
driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT) #Doesn't Work
driver.find_element_by_xpath("//body").send_keys(Keys.UP) #Works
driver.find_element_by_xpath("//body").send_keys(Keys.LEFT) #Doesn't Works

Expected Results: Focus should move in same directions as many times as the send keys methods are called.

Bellow key press event should move the selection in safari10 browser to three selections in the right and two selection down and two selection to left.


Example:

driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT)
driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT)
driver.find_element_by_xpath("//body").send_keys(Keys.RIGHT)
driver.find_element_by_xpath("//body").send_keys(Keys.DOWN)
driver.find_element_by_xpath("//body").send_keys(Keys.DOWN)
driver.find_element_by_xpath("//body").send_keys(Keys.LEFT)
driver.find_element_by_xpath("//body").send_keys(Keys.LEFT)

Actual Results:

focus will move right only once. second time key press even wont move the focus if it is in same direction.



Notes: The above example and steps works fine with the Firefox.

[Python Selenium SafariDriver] Unable to repeat same key press event more than once
 
 
Q