How to solve selenium firefox browser is under remote control?
Asked Answered
T

2

8

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 :)")
Thorfinn answered 13/11, 2020 at 5:39 Comment(3)
It says browser is under remote control since the browser is under remote control. Why do you want to ignore it? That is not a problem and what would we expect to solve?Nephrosis
@BarışÇiçek , Is it just at the client end or other trackers can easily understand it is under control...Thorfinn
The most valid reason for wanting to suppress this message (or make it at least less gaudy) would be for creating demos for larger presentations or marketing videos. The way it's implemented now is extremely distracting, perhaps by design.Fuddyduddy
P
0

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.

Peraea answered 3/1, 2021 at 17:27 Comment(0)
C
-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.

Cist answered 11/3, 2022 at 15:13 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Wrennie
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewSixgun

© 2022 - 2024 — McMap. All rights reserved.