Help with the script selenium-with-fingerprints
-
Hello!
I use the selenium-with-fingerprints library on node.js with the paid FingerSwitcher key.There is a script:
const { plugin } = require('selenium-with-fingerprints'); (async () => { // Запускаем экземпляр браузера: const driver = await plugin.launch(); let url = 'https://explore.whatismybrowser.com/useragents/parse/?analyse-my-user-agent=yes'; while (true) { // Получаем фингерпринт с сервера: const fingerprint = await plugin.fetch('213213123', { tags: ['Microsoft Windows', 'Chrome'], // Указываем теги для фингерпринта minBrowserVersion: 98, // Указываем минимальную версию браузера timeLimit: '15 days', // Указываем время действия фингерпринта }); // Применяем фингерпринт: plugin.useFingerprint(fingerprint); // Открываем вкладку и переходим на сайт: await driver.get(url); await driver.sleep(5000); // Очищаем cookies и local storage: await driver.executeScript('window.localStorage.clear();'); await driver.executeScript('window.sessionStorage.clear();'); await driver.manage().deleteAllCookies(); // Получаем второй фингерпринт с сервера: const fingerprint2 = await plugin.fetch('123123123123', { tags: ['Microsoft Windows', 'Firefox'], // Указываем теги для фингерпринта minBrowserVersion: 92, // Указываем минимальную версию браузера timeLimit: '15 days', // Указываем время действия фингерпринта }); // Применяем второй фингерпринт: plugin.useFingerprint(fingerprint2); // Обновляем страницу: await driver.get(url); await driver.sleep(2000); // Очищаем cookies и local storage: await driver.executeScript('window.localStorage.clear();'); await driver.executeScript('window.sessionStorage.clear();'); await driver.manage().deleteAllCookies(); } })();
I want to use in an infinite loop to, first:
- change the fingerprint
- opens https://explore.whatismybrowser.com/useragents/parse/?analyse-my-user-agent=yes
- cleared the cache \ cookies
- change the fingerprint again
- refresh the page
And then the page would be refreshed.
Unfortunately, node js doesn't allow to call two functions in a row. How can I make my fingerprint change in a loop?
Thanks in advance!
Translated with www.DeepL.com/Translator (free version)