python - 发送键和弦以打开新标签 Selenium Python
问题描述
我有这个超级简单的代码,我试图在 ChromeDriver 上运行,但它不起作用。Java 等效项工作正常。我想打开一个新标签,但任何发送多个密钥的工作方式都会很棒。
driver.get("https://www.google.com")
action = ActionChains(driver)
action.key_down(Keys.CONTROL).send_keys("t").key_up(Keys.CONTROL).perform()
提前致谢
解决方案
我也无法让你的方法起作用,我不知道为什么。不过,这确实对我有用:
driver.execute_script("window.open('');")
推荐阅读
- docker - Docker-compose:OCI 运行时创建失败,entrypoint.sh 没有这样的文件或目录
- java - 下载 Android TTS 音频
- c++ - c++ 中的异常处理(在 if 语句中)
- php - 如果网站在 Google 搜索结果中列出,则防止包含 PHP 文件
- angular - 正则表达式匹配 Angular 代理中的各种 URL
- jmeter-plugins - 在 JMeter 中,为什么加载时间等于延迟?
- apache - Apache .htacess 重定向
- google-sheets - QUERY 和 IMPORTRANGE 的问题 | 谷歌表格
- swiftui - 在 Touch Bar 中显示 TabView 元素 - SwiftUI
- microsoft-graph-api - 图 api me/messages 端点不允许在选择列表中开始和结束日期时间