Python selenium.webdriver.common.keys.Keys.LEFT Examples
The following are 3
code examples of selenium.webdriver.common.keys.Keys.LEFT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
selenium.webdriver.common.keys.Keys
, or try the search function
.
Example #1
Source File: node.py From capybara.py with MIT License | 6 votes |
def send_keys(self, *args): """ Send keystrokes to the node. Examples:: from selenium.webdriver.common.keys import Keys element.send_keys("foo") # => value: "foo" element.send_keys("tet", Keys.LEFT, "s") # => value: "test" Args: *args: Variable length list of keys to send. """ raise NotImplementedError()
Example #2
Source File: element.py From capybara.py with MIT License | 6 votes |
def send_keys(self, *args): """ Send keystrokes to the element. Examples:: from selenium.webdriver.common.keys import Keys element.send_keys("foo") # => value: "foo" element.send_keys("tet", Keys.LEFT, "s") # => value: "test" Args: *args: Variable length list of keys to send. """ self.base.send_keys(*args)
Example #3
Source File: 2048.py From automate-the-boring-stuff-projects with MIT License | 5 votes |
def play(): """ Args: None Returns: None """ driver = webdriver.Firefox(executable_path='/Users/keneudeh/Downloads/geckodriver') driver.get('https://play2048.co/') key_select = [Keys.UP, Keys.DOWN, Keys.LEFT, Keys.RIGHT] gameStatusElem = driver.find_element_by_css_selector('.game-container p') htmlElem = driver.find_element_by_css_selector('html') while gameStatusElem.text != 'Game over!': htmlElem.send_keys(key_select[random.randint(0, 3)]) gameStatusElem = driver.find_element_by_css_selector('.game-container p') score = driver.find_element_by_css_selector('.score-container').text print(f'You scored: {score}')