python - 有没有办法使用 Selenium 禁用 chrome “同源”策略?
问题描述
我正在尝试编写一个脚本,在该脚本中我在 iframe 中抓取元素,但我得到了
Uncaught DOMException: Blocked a frame with origin "https://kith.com" from accessing a cross-origin frame.
我试过这个脚本:
from selenium import webdriver
import os
chop = webdriver.ChromeOptions()
chop.add_argument("--disable-web-security")
# create new Chrome driver object with Chrome extension
driver = webdriver.Chrome(executable_path='chromedriver.exe', options=chop)
并使用我的 chrome 扩展,我尝试在 iframe 中抓取一个元素,但它说它仍然给了我这个错误
解决方案
推荐阅读
- list - 一个函数,它根据第一个索引列表从第二个列表中获取相应的元素
- wordpress - 激活 WPML 插件后如何获取 WordPress 中的所有页面?
- flutter - 如何将文本控制器的输入作为双精度输入?- 颤动
- python - 我想提取成员的链接
- reactjs - 我在哪里可以找到 create-react-app 选项的列表?
- javascript - 如果声明让我感到困惑
- javascript - 如何在javascript中编辑css
- python - 用切片解释范围
- tensorflow - 在 CMake 中检查 tensorflow 版本
- visual-studio - 应用 cmd 和 Web 配置错误 - 解析站点名称