Complete the code to press the Control key down.
from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys actions = ActionChains(driver) actions.[1](Keys.CONTROL).perform()
key_up instead of key_down.send_keys which sends keys but does not hold them down.The key_down method presses a key down without releasing it.
Complete the code to release the Control key after pressing it.
actions = ActionChains(driver)
actions.key_down(Keys.CONTROL).[1](Keys.CONTROL).perform()click which clicks the mouse, not keys.send_keys which sends keys but does not release keys.The key_up method releases a key that was pressed down.
Fix the error in the code to hold Shift, type 'a', then release Shift.
actions = ActionChains(driver)
actions.key_down(Keys.SHIFT).send_keys([1]).key_up(Keys.SHIFT).perform()When holding Shift, sending lowercase 'a' will produce uppercase 'A'. So the key sent should be lowercase 'a'.
Fill both blanks to press Control+C to copy text.
actions = ActionChains(driver) actions.[1](Keys.CONTROL).send_keys([2]).key_up(Keys.CONTROL).perform()
key_up instead of key_down to press Control.Use key_down to press Control, send lowercase 'c' to copy, then release Control with key_up.
Fill all three blanks to press Control+Shift+S to save as.
actions = ActionChains(driver) actions.[1](Keys.CONTROL).[2](Keys.SHIFT).send_keys([3]).key_up(Keys.SHIFT).key_up(Keys.CONTROL).perform()
key_up to press keys down.Press Control and Shift down with key_down, send lowercase 's', then release Shift and Control.
