as the subject says, i want to open web page, double click on word, after that once the word is selected to do mouse right click and select copy from the menu. till now i have the following code which do everything, open google, click on word, invoke the mouse right click but i have no idea how to do/use down arrow key to select copy. here is the code:
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox()
driver.get("https://www.google.com/?hl=en")
codeID = driver.find_element(By.XPATH, '//*[@id="SIvCob"]')
ActionChains = ActionChains(driver)
ActionChains.double_click(codeID).perform()
ActionChains.context_click(codeID).perform();
i found some solutions in java and tried to implement those in python, but non of those worked, for example as this one (which I tried to use as a replacement for the last line of my code):
from selenium.webdriver.common.keys import Keys
ActionChains.context_click(codeID).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).perform();
please if someone can help me how to do this. thanks!
so in case anyone have the problem, this worked for me
and the code was copied in the clipboard.