Automate Prompts? #16
Replies: 2 comments
-
Yes, you can. If it will be interesting next month I will translate the script into account farm for Windows, Linux, MacOS. |
Beta Was this translation helpful? Give feedback.
-
See I wrote a simple code for logging in and creating an .ini Firefox - https://www.mozilla.org/uk/firefox/new/ After installation, we do this hierarchy Now let's move on to main.py We need selenium for the robot pip install selenium main.py code : import os
import time
import selenium.webdriver as webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
import configparser
config = configparser.ConfigParser()
def on_browser_close(*args):
flag_browser_close = True
while(flag_browser_close):
if (browser.current_url == url):
cookies = browser.get_cookies()
for cookie in cookies:
if cookie['name'] == 'PHPSESSID':
if cookie['value'] != 'None':
config.read('config.ini')
if not config['DEFAULT'].get('cookie'):
config['DEFAULT']['cookie'] = cookie['value']
with open('config.ini', 'w') as cofFILE :
config.write(cofFILE)
browser.close()
flag_browser_close = False
break
time.sleep(5)
url_open = 'https://www.steamgifts.com/discussions/deals'
url = 'https://www.steamgifts.com/'
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0'
firefox_driver = os.path.join(os.getcwd(), 'Drivers', 'geckodriver.exe')
firefox_service = Service(firefox_driver)
firefox_option = Options()
firefox_option.set_preference("general.useragent.override", user_agent)
browser = webdriver.Firefox(service=firefox_service, options=firefox_option)
browser.implicitly_wait(7)
browser.get(url_open)
on_browser_close() The result of the robot : YouTube The code is for the windows operating system but I think we can modify it to suit ourselves. |
Beta Was this translation helpful? Give feedback.
-
Is there anyway to pre-enter the prompts at the beginning in an ini or through arguments to fully automate the process?
Beta Was this translation helpful? Give feedback.
All reactions