【发布时间】:2019-12-13 16:04:58
【问题描述】:
我想右键单击并使用 Selenium 执行一项操作,但我做不到。我可以右键单击,但它不执行该操作。我希望任何人都可以帮助我。下面是代码。
谢谢...
import openpyxl
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
option = Options()
option.add_argument("--disable-infobars")
option.add_argument("start-maximized")
option.add_argument("--disable-extensions")
option.add_experimental_option("excludeSwitches", ['enable-automation'])
# Pass the argument 1 to allow and 2 to block
option.add_experimental_option("prefs", {
"profile.default_content_setting_values.notifications": 1
})
driver = webdriver.Chrome(options=option, executable_path='C:\\Users\\Sheik\\Desktop\\web crawling\\chromedriver.exe')
url = "https://www.filepicker.io/api/file/xSc5NYKZQaun3B4LARLZ"
driver.get(url)
save_video = driver.find_element_by_name('media')
action = ActionChains(driver)
action.context_click(save_video).send_keys(Keys.ARROW_DOWN).perform()
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver web-scraping