Reputation: 81
I'm using selenium with firefox 82.0.3 (64)
The code is working properly but the issue is that it is saying browser is under remote control.
Is there any way to solve it or other ways to bypass it.
What I actually want to do with selenium is to open a new firefox instance with a new proxy defined by me each time I execute my code..
Thanks in Advance
Here's is my code snipet.
import webbrowser
import time
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
fbgroups = open("all.txt").readlines()
whitelist = open("ntp.txt").readlines()
llf = open('last.txt',"r")
print("Total groups: " + str(len(fbgroups)))
print("Whitelisted: " + str(len(whitelist)))
print("Last: " + str(llf.read()))
# var = int(input('\nStart from: '), 10)
var = 1
myProxy = "us.smartproxy.com:18000"
PROXY_HOST, PROXY_PORT = myProxy.split(":")
while True:
for a in range (len(fbgroups)-var,0, -1):
print("Line No: " + str(a+1))
matched = False
for b in range (len(whitelist)):
if whitelist[b].replace('\n', '') in fbgroups[a].replace('\n', ''):
print("URL"+str(a) + ": Match: " + fbgroups[a])
matched = True
break
if (matched == False):
lastLink = open('last.txt',"w+")
lastLink.write(str(len(fbgroups)-a))
lastLink.close()
print("URL"+ str(a)+ ": " + fbgroups[a])
myprofile = webdriver.FirefoxProfile()
myprofile.set_preference("network.proxy.type", 1)
myprofile.set_preference("network.proxy.http",PROXY_HOST)
myprofile.set_preference("network.proxy.http_port",int(PROXY_PORT))
myprofile.set_preference("network.proxy.ssl",PROXY_HOST)
myprofile.set_preference("network.proxy.ssl_port",int(PROXY_PORT))
myprofile.set_preference("network.proxy.ftp",PROXY_HOST)
myprofile.set_preference("network.proxy.ftp_port",int(PROXY_PORT))
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'
myprofile.set_preference("general.useragent.override", user_agent)
myprofile.update_preferences()
driver = webdriver.Firefox(firefox_profile=myprofile, executable_path=r'C:\Users\Administrator\Downloads\geckodriver.exe')
driver.get(fbgroups[a])
print("Page Title is : %s" %driver.title)
input()
print("ALL DONE :)")
Upvotes: 8
Views: 10731
Reputation: 27
You can use userChrome.css to remove the robot icon and the gradient:
/*hide the robot icon*/
#remote-control-box{
display: none;
}
/*hide the striped background*/
#urlbar-background{
background-image: unset !important;
}
enable legacy stylesheet customization in firefox, and then set the modified profile in the FirefoxOptions. In C# its like this, in python it will be similar.
string programPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
//assuming the custom firefox profile is in the same folder as the binary of the program
ffo.Profile = new FirefoxProfile(programPath + "/firefoxProfile/");
Upvotes: 1
Reputation: 1
I switched to Firefox yesterday and today, after restarting my Windows 11 laptop, Firefox started opening up like crazy.
The problem was same, so I think the JavaScript programs in DevTools are running, but they have access. Another reason I think it happened is because of PowerShell, that also opened up immediately after restart. Windows may also be able to go inside any application.
Upvotes: -1
Reputation: 38797
Your browser is under remote control, that's why it says it's under remote control.
The only way to remove the message is to disable remote control for the current profile. In about:config
reset marionette.enabled
to false and restart.
If all you want to do is set up a new profile and launch Firefox, you don't need selenium. Manually create a new profile folder, add prefs.js
with the proxy settings, and pass the -profile
option when launching Firefox.
Upvotes: 0