Índice

Using Selenium with GoLogin

Many routine tasks in the browser can be automated. Tools like Selenium help with this. They are most commonly used for testing Web applications, administering a site, or parsing data from different sites. Sometimes anonymity is needed to perform these tasks, sometimes emulation of different platforms, devices, and other parameters. Both can be done in GoLogin! Therefore, we have prepared for you a short guide on how to use Selenium in GoLogin.GoLogin allows you to use the Orbita antidetect browser through Puppeteer. By setting profiles in the program, you can emulate various devices, platforms, screen resolutions, geolocation, time zones, the presence of WebRTC, specify your proxies or proxies of the desired country, etc.

In this case, cookies and a digital fingerprint of the browser will be saved in the profile so that, for example, the site does not require re-authorization. Also, the fingerprint can be changed if you want to emulate the use of a new browser.

Chromedriver is required for Selenium. Its current version for working with GoLogin is located in the github.com/gologinapp/pygologin An example is given in Python (3.8)

Below is the full parser code, then we will analyze the main points separately.


 from sys import platform
 from selenium import webdriver
 from selenium.webdriver.chrome.options import Options
 from gologin import GoLogin

 gl = GoLogin({
     'token': 'yU0token',
     'profile_id': 'yU0Pr0f1leiD',
 })

 if platform == "linux" or platform == "linux2":
     chrome_driver_path = './chromedriver'
 elif platform == "darwin":
     chrome_driver_path = './mac/chromedriver'
 elif platform == "win32":
     chrome_driver_path = 'chromedriver.exe'

 debugger_address = gl.start()
 chrome_options = Options()
 chrome_options.add_experimental_option("debuggerAddress", debugger_address)
 driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options)
 driver.get("http://www.python.org")
 assert "Python" in driver.title
 driver.close()
 time.sleep(3)
 gl.stop()
                            

First of all, an instance of the GoLogin class is created, in the parameters of which the access token and the profile that we will run are specified. The Orbita executable file is searched for in the user’s directory by default (it can be overridden by the executablePath parameter):


 const GL = new GoLogin({
     profile_id: 'yU0Pr0f1leiD',
     token: 'yU0token',
 });
  

Then we give the command to launch the remote browser and, after receiving the link, it is transmitted to Selenium:


 debugger_address = gl.start()
 chrome_options = Options()
 chrome_options.add_experimental_option("debuggerAddress", debugger_address)
 driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options)
                              

Next, go to the python.org website and check whether we got there:


 driver.get("http://www.python.org")
 assert "Python" in driver.title
                              

To complete the work, close the driver and stop the profile. Done! This way you can use Selenium to work with GoLogin. If you still have any questions, write them in the comments, we will be happy to answer!

Gerir várias contas sem proibições e bloqueios
Ler também
o que é geração de leads

O que é Geração de leads: Por onde começar em 2024?

Estás pronto para atrair os teus primeiros clientes? Comecemos por abordar as lacunas na compreensão da geração de leads B2B: eis os princípios básicos.

Launching a mobile browser in GoLogin

Launching a mobile browser is one of the most important blocking avoidance tools.

Brave Browser alternative

Procura uma Brave Browser alternative? Considerar este

Está à procura de uma decente ao Brave Browser alternative para uma melhor privacidade? Veja como o GoLogin proporciona anonimato com um motor de impressões digitais de topo.

Gostaríamos de ouvir as suas perguntas, comentários e sugestões. Contacte-nos em [email protected] ou deixe um comentário acima.

Está a começar a utilizar o GoLogin? Esqueça a suspensão ou o cancelamento da conta. Escolha qualquer plataforma Web e gira facilmente várias contas. Clique aqui para começar a utilizar todas as funcionalidades GoLogin