问题
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.
回答1:
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 firefox through the Robot icon along with the tool tip which reads "Browser is under remote control"
来源:https://stackoverflow.com/questions/62515292/how-to-remove-the-message-browser-is-under-remote-control-from-firefox-using-sel