Selenium によるブラウザの自動化

以下の例では、Selenium を使用して GoLogin を操作する方法を示します。GoLogin テクノロジを使用すると、Orbita ブラウザーを使用できます。Orbita ブラウザーでは、操り人形師を介して独自のブラウザー スナップショットを使用できます。 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 さまざまなデバイス、プラットフォーム、画面解像度、地理位置情報、タイムゾーン、WebRTC の可用性をエミュレートし、プロキシまたは必要な国のプロキシを指定できる Web サイト。同時に、Cookie と一般的なブラウザのフィンガープリントが保存されますサイトが再認証を必要とせず、新しいブラウザをエミュレートする必要がある場合に別のコマンドで変更できるように、プロファイルに. 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 には chromedriver が必要です。GoLogin を操作するための最新バージョンは、selenium ディレクトリの github.com/gologinapp/gologin リポジトリにあります。

Python (3.8) で例を示します

完全なパーサー コードを以下に示します。要点を個別に分析します。


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

										

最初のステップは、GoLogin クラスのインスタンスを作成することです。そのパラメーターでは、実行するアクセス トークンとプロファイルを指定する必要があります。Orbita 実行可能ファイルは、デフォルトでユーザーのディレクトリで検索されます ( executablePath パラメーターでオーバーライドできます):


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

次に、リモート ブラウザーを起動するコマンドが与えられ、リンクを受信した後、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)
										

次に python.org の Web サイトにアクセスして、適切な場所に到達したことを確認してください:


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

										

作業を完了するには、ドライバーを閉じてプロファイル停止を実行します

この方法で、Selenium を GoLogin で使用できます。

BANやブロックを受けずに複数のアカウントを運用する

こちらもお読みください

ドロップシッピング

Shopifyでドロップシッピングを作る方法:初心者ガイド 2024

このガイドでは、shopifyでドロップシッピングを作る方法、そしてShopifyでドロップシッピングビジネスを始め、大きな利益を得る方法を説明します。

最高のデジタルマーケティングツール

最高のデジタルマーケティングツール:2024年版トップ69

実績のあるツールから隠れた名品まで、あなたのビジネスのマーケティング活動を加速させるデジタルマーケティングツール69選をご紹介します。

アカウント ファーム: 必要か気まぐれか?

Cookie、拡張機能、行動要因はどの程度重要ですか?