【问题标题】:How to remove the message Browser is under remote control from Firefox using Selenium如何使用 Selenium 从 Firefox 中删除消息浏览器处于远程控制之下
【发布时间】:2020-10-12 08:46:37
【问题描述】:

我想在使用 python3 使用 selenium 运行 firefox 时删除此机器图标

这是我的代码:-

from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
profile = webdriver.FirefoxProfile('C:\\Users\\you\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\64nrwj2y.default-release')
PROXY_HOST = "87.255.27.163"
PROXY_PORT = "3128"
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
profile.set_preference("general.useragent.override", user_agent)
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", PROXY_HOST)
profile.set_preference("network.proxy.http_port", int(PROXY_PORT))
profile.set_preference("dom.webdriver.enabled", False)
profile.set_preference('useAutomationExtension', False)
options=webdriver.firefox.options.Options()
profile.update_preferences()
desired = webdriver.DesiredCapabilities.FIREFOX
binary = FirefoxBinary('D:\\Mozilla Firefoxy\\firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=profile, executable_path=GeckoDriverManager().install(), desired_capabilities=desired)
driver.get('https://stackoverflow.com')

但它总是这样显示。

【问题讨论】:

    标签: python selenium selenium-webdriver firefox geckodriver


    【解决方案1】:

    根据WebDriver W3C SpecificationAbstract 部分,WebDriver 是一个远程控制界面,可以对用户代理进行自省和控制。它提供了一个独立于平台和语言中性的有线协议,作为进程外程序远程指示 Web 浏览器行为的一种方式。

    WebDriver 为我们提供了一组接口来发现和操作 Web 文档中的 DOM 元素并控制用户代理的行为。它的主要目的是允许编写测试以从单独的控制过程中自动化用户代理,并且还可以以允许浏览器内脚本控制单独的浏览器的方式使用。

    此外,在规范的Security 部分还提到建议用户代理努力在视觉上区分受WebDriver 控制的用户代理会话与用于正常浏览会话的用户代理会话。这可以通过浏览器 chrome 元素来完成,例如 门衣架、操作系统窗口的彩色装饰或窗口中流行的一些小部件元素,以便于识别自动化窗口。 p>

    此功能在 中通过Robot 图标以及显示为"Browser is under remote control"

    工具提示 实现

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-25
      • 2019-09-12
      • 2014-08-26
      • 2022-01-17
      • 1970-01-01
      • 1970-01-01
      • 2010-10-23
      • 1970-01-01
      相关资源
      最近更新 更多