如何在机器人框架中向 chrome webdriver 添加新的请求头

问题描述

我需要向 chrome webdriver 添加一个新的请求标头。在手动测试中,我们使用 ModHeader 扩展向浏览器添加新的自定义请求头。

我尝试了以下选项,但没有奏效。

from google.cloud import storage

def download_blob(bucket_name,source_blob_name,destination_file_name):
    """Downloads a blob from the bucket."""
    # bucket_name = "your-bucket-name"
    # source_blob_name = "storage-object-name"
    # destination_file_name = "local/path/to/file"

    storage_client = storage.Client()

    bucket = storage_client.bucket(bucket_name)

    # Construct a client side representation of a blob.
    # Note `Bucket.blob` differs from `Bucket.get_blob` as it doesn't retrieve
    # any content from Google Cloud Storage. As we don't need additional data,# using `Bucket.blob` is preferred here.
    blob = bucket.blob(source_blob_name)
    blob.download_to_filename(destination_file_name)

    print(
        "Blob {} downloaded to {}.".format(
            source_blob_name,destination_file_name
        )
    )

如何使用自定义请求标头启动 Web 应用程序?

我们可以将客户请求标头添加到 chrome 选项并使用这些选项创建 webdriver 吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)