Action Chains & Special Keys
On this page you'll learn about Action Chains, special keys, and special key combinations
Introduction
Simple Selenium Action Chains
#Start chrome webdriver with custom options
driver=SimpleSelenium("chrome",save_profile=True,profile_name="myAwesomeProfile",save_logs_in_file=True,maximized=True)
#Visit Google
driver.visit("https://google.com")
#Locate the main search bar
textArea=driver.by_tag("textarea")
#Use ActionChains to click the search bar
thisActionChain=driver.actionChains.click(textArea).press_key("t").press_key("e").press_key("s").press_key("t").press_key("enter")
thisActionChain.perform() #Executes all actions in the chain (click search bar, type "test", click enter). This is not the optimal way to type text in an input, but just an example for Action Chains
#You can add as many actions as you like onto an action chain, they get executed in order.Executing Special Key Commands (eg. ctrl-c, ctrl-v)
List of Simple Selenium Action Chains Methods
Press Key
Key Down
Key Up
Click
Click & Hold
Release Click Hold
Context/Right Click
Double Click
Drag & Drop
Drag & Drop By Offset
Move Mouse By Offset
Move Mouse To Element
Move Mouse To Element With Offset
Reset Actions
Scroll By Amount
Scroll To Element
Pause
Perform
Special Key Aliases
Last updated