使用 ChromeDriver 设置网络连接时出现错误“必须启用网络连接”,即使启用了移动仿真

时间:2021-03-01 17:46:44

标签: python selenium webdriver selenium-chromedriver

我正在尝试限制网络吞吐量,但我无法克服这个错误。

popUntil

我的输出是:

from selenium import webdriver
from selenium.webdriver.remote.command import Command    
mobile_emulation = {"deviceName": "Nexus 5"}    
chrome_options = webdriver.ChromeOptions()    
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)    
driver = webdriver.Remote(
    command_executor="http://127.0.0.1:4444/wd/hub",
    desired_capabilities=chrome_options.to_capabilities(),
)    
driver.execute(
    Command.SET_NETWORK_CONNECTION,
    {
        "offline": False,
        "latency": 5,
        "download_throughput": 500 * 1024,
        "upload_throughput": 500 * 1024,
    },
)

Selenium 版本 4.0.0b1,Python 3.7.7。

我已经阅读了 Network throttling with chrome and seleniumerror "network connection must be enabled" while setting networkConnection with ChromeDriver,但我仍然无法弄清楚。

0 个答案:

没有答案