小编NKS*_*KSM的帖子

将所需的功能转换为 selenium python 中的选项

我想将一组所需的功能转换为 selenium Python 中的选项。在下面的代码中,我想找到dc["goog:loggingPrefs"] = {"browser":"INFO"} 与 selenium python 中的选项等效的内容。

我查看过: https: //peter.sh/experiments/chromium-command-line-switches/ 查看是否有等效的loggingPrefs选项开关,但似乎没有。下面的代码适用于 Selenium 4.7.2,但问题是,如果我们更新到 Selenium 4.10(最新),当作为关键字参数传递给 webdriver 时,将不再支持desired_capability。据我所知,大多数基本的所需功能都由浏览器版本、名称等选项支持。我们如何将loggingPrefs所需的功能转换为selenium webdriver的选项。

  def printConsoleLogs():
   options = Options()
   options.add_experimental_option('excludeSwitches', ['enable-logging'])

   #includes INFO level console messages, otherwise only SEVERE show
   dc = DesiredCapabilities.CHROME.copy()
   dc["goog:loggingPrefs"] = {"browser":"INFO"}

   driver = webdriver.Chrome(service=service, options=options, desired_capabilities=dc)
   driver.get("http://www.thepools.com")

   time.sleep(5)

   for entry in driver.get_log('browser'):
        print(entry)
Run Code Online (Sandbox Code Playgroud)

编辑,找到解决方案,留给将来寻找相同答案的人:

使用options.set_capability("goog:loggingPrefs", {browser: "INFO"})

.set_capability(name, value),允许您将所需的功能转换为硒选项

python selenium-chromedriver selenium-webdriver

7
推荐指数
0
解决办法
2154
查看次数

AZURE DATA FACTORY - 系统找不到输入的环境选项

我正在尝试在自托管集成运行时配置文件系统链接服务,但在测试连接时出现以下错误:

Cannot connect to [path]. Detail Message: The system could not find the environment option that was entered
The system could not find the environment option that was entered.
Run Code Online (Sandbox Code Playgroud)

但是,IR 已配置并连接到云服务。我可能缺少一些防火墙规则吗?云还是本地?提前致谢

cloud integration azure azure-data-factory

5
推荐指数
1
解决办法
2918
查看次数

什么是 queryset = super().get_queryset()?

这两段代码是一样的

class PostDetail(generic.DetailView):
    model = models.Post

    def get_queryset(self):
        queryset = super().get_queryset()
        return queryset.filter(.........)
Run Code Online (Sandbox Code Playgroud)

class PostDetail(generic.DetailView):
    model = models.Post

    def get_queryset(self):
        return post.filter(.........)
Run Code Online (Sandbox Code Playgroud)

这条线实际上是做queryset = super().get_queryset()什么的,如果没有这条线会发生什么?

django django-queryset django-views django-rest-framework

1
推荐指数
1
解决办法
528
查看次数