如何删除消息浏览器受Firefox使用Selenium的远程控制 [英] How to remove the message Browser is under remote control from Firefox using Selenium

查看:368
本文介绍了如何删除消息浏览器受Firefox使用Selenium的远程控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用python3使用硒运行Firefox时删除此计算机图标

这是我的代码:-

从硒导入Webdriver的

 从webdriver_manager.firefox导入GeckoDriverManager从selenium.webdriver.firefox.firefox_binary导入FirefoxBinary配置文件= 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,如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()所需= webdriver.DesiredCapabilities.FIREFOX二进制= FirefoxBinary('D:\\ Mozilla Firefoxy \\ firefox.exe')driver = webdriver.Firefox(firefox_binary =二进制,firefox_profile = profile,executable_path = GeckoDriverManager().install(),desirable_capabilities = desired)driver.get('https://stackoverflow.com') 

但是它一直这样显示.

解决方案

根据

I want to remove this machine icon while running firefox using selenium using python3

Here is my code :-

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')

But it keeps showing like this.

解决方案

As per the Abstract section of WebDriver W3C Specification WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform independent and language neutral wire protocol as a way for out-of-process programs to remotely instruct the behavior of web browsers.

WebDriver provides us a set of interfaces to discover and manipulate DOM elements in web documents and to control the behavior of a user agent. It is primarily intended to allow to write tests that automate a user agent from a separate controlling process and also be used in such a way as to allow in-browser scripts to control a separate browser.

Further, in the Security section of the specification also mentions that it was suggested that user agents make an effort to visually distinguish a user agent session that is under control of WebDriver from those used for normal browsing sessions. This can be done through a browser chrome element such as a door hanger, colorful decoration of the OS window, or some widget element that is prevalent in the window so that it easy to identify automation windows.

This feature is implemented in through the Robot icon along with the tool tip which reads "Browser is under remote control"

这篇关于如何删除消息浏览器受Firefox使用Selenium的远程控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆