简体   繁体   English

按 Ctrl+Shift+c 使用 Selenium webdriver 不工作

[英]Press Ctrl+Shift+c using Selenium webdriver is not working

driver.get("https://www.google.com) 

I want to simulate the process of pressing the Ctrl+Shift+c with selenium我想用selenium来模拟按Ctrl+Shift+c的过程

I have tried:我努力了:

  1.    actions
            .keyDown(Keys.CONTROL)
            .keyDown(Keys.SHIFT)
            .sendKeys("c")
            .build()
            .perform();

  2.    action.sendKeys(Keys.chord(Keys.SHIFT + Keys.CONTROL + "c")).perform();

There are many answers in StackOverflow,but nothing works StackOverflow 中有很多答案,但没有任何作用

You are looking for something like pyautogui selenium actions do not behave as you are expecting.您正在寻找pyautogui selenium 之类的操作不符合您的预期。

from selenium import webdriver
import pyautogui

driver = webdriver.Chrome(executable_path=r'C:\\Path\\To\\Your\\chromedriver.exe')
driver.get("https://www.google.com")

pyautogui.hotkey('ctrl','shift', 'c')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM