Índice

Browser automation with Selenium

In the example below I will show you how to use Selenium for work with GoLogin. GoLogin technology allows you to use the Orbita browser, where you can use the unique browser snapshots through puppeteer. By setting up profiles on the gologin.com website you can emulate various devices, platforms, screen resolution, geolocation , timezone, availability of WebRTC , specify your proxies or proxies of the required country, etc. At the same time cookies and a common browser fingerprint will be saved in the profile so that the site does not require re-authorization and it can be changed with another command if you need to emulate a new browser.

Selenium requires a chromedriver. It’s latest version for working with GoLogin is located in the github.com/gologinapp/gologin repository in the selenium directory.

An example is given in Python (3.8)

The full parser code is presented below. I will analyze the main points separately.


import time
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()

										

The first step is to create an instance of the GoLogin class. In its parameters, you need to specify the access token and the profile that we will run. The Orbita executable file is searched by default in the user’s directory (can be overridden by the executablePath parameter):


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

Then a command to launch remote browser is given 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 that we got to the right place:


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

										

To complete the work close the driver and execute the profile stop

This way you can use Selenium for work with GoLogin.

Gerir várias contas sem proibições e bloqueios
Ler também
melhores sites de apostas

Os 10 melhores sites de apostas para ganhar muito em 2024

Vamos dar uma vista de olhos aos 10 melhores sites de apostas em 2024. Estas plataformas distinguem-se pelo seu empenhamento na satisfação do cliente e na inovação.

Alternativa ao navegador Hidemyacc: Análise honesta do 2024

O Hidemyacc parece ser uma ferramenta adequada para o preço em 2024. No entanto, não é tão bom debaixo do capô: leia a análise para factos e números.

BitBrowser

BitBrowser Review 2024: Vale a pena comprar para negócios?

O BitBrowser parece ser uma cópia do navegador AdsPower, que oferece uma série de coisas por apenas 10 dólares por mês. Há algum senão escondido?

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