Automating Python’s Selenium on a Raspberry Pi 3-4 using Firefox Geckodrivers

Published: 17 October 2022
on channel: ZeroLife
1,271
11

Visit https://github.com/mozilla/geckodrive...
Raspberry Pi 3-4 geckodrivers (geckodriver-v0.32.0-linux-aarch64.tar.gz)

import re, time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

from selenium.webdriver.firefox.options import Options as FirefoxOptions
from selenium.webdriver.firefox.service import Service


def func():
DELAY = 30
global str_rate, str_date, str_gross, str_deduct, str_netpay, str_days
str_rate, str_date, str_gross, str_deduct, str_netpay, str_days = '','','','','',''

FF_OPTIONS = [
'--headless',
'--no-sandbox',
'--disable-xss-auditor',
'--disable-web-security',
'--ignore-certificate-errors',
'--log-level=3',
'--disable-notifications'
]

SET_PREF = {
'general.useragent.override':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
'permissions.default.desktop-notification': 1,
'dom.webnotifications.enabled': 1,
'dom.push.enabled': 1,
'intl.accept_languages': 'en-US'
}

options = FirefoxOptions()
[options.add_argument(opt) for opt in FF_OPTIONS]
[options.set_preference(key,value) for key,value in SET_PREF.items()]

print('[*] Starting Driver')
path_gecko = '/path/geckodriver'
driver = webdriver.Firefox(service=Service(path_gecko),options=options)
driver.get('https://website/')

time.sleep(DELAY)
print('[*] Inputting Login')

elem = driver.find_element(By.ID, 'i0116')
elem.send_keys("myUsername")
elem.send_keys(Keys.RETURN)

time.sleep(DELAY)
print('[*] Inputing Password')

elem = driver.find_element(By.ID, 'i0118')
elem.send_keys("myPassword")
elem.send_keys(Keys.RETURN)

time.sleep(DELAY)
print('[*] Visiting https://website/Personal/PayStub')

elem2 = driver.get('https://website/Personal/PayStub')
time.sleep(DELAY)
print('[*] Getting Page Source')

str_source = str(driver.page_source)
str_page = re.sub(..., ...,str_source).replace('\n','').replace('\r',''))
list_data1 = re.findall(...,str_page)
print(list_data1,'\n')

str_days = list_data1[9]
str_gross = list_data1[10]
str_netpay = list_data1[30]

DONATE:
---------------
PAT:   / rezatahirkheli  
PP: https://www.paypal.com/paypalme/rezat...
BTC: 3EUQBWZKX9Vcwdffd3cUGATQopxrAQQxJ9
LTC: MBXE6hJgxxFYSD8SjmR7sHCHGTqFXmNGoU


Watch video Automating Python’s Selenium on a Raspberry Pi 3-4 using Firefox Geckodrivers online without registration, duration hours minute second in high quality. This video was added by user ZeroLife 17 October 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,271 once and liked it 11 people.