41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
|
|
# import traceback
|
|
from abc import ABC, abstractmethod
|
|
from email.mime.text import MIMEText
|
|
|
|
from helium import *
|
|
from selenium.webdriver import ChromeOptions
|
|
|
|
|
|
class Fund(ABC):
|
|
def __init__(self, url, mobile=True, headless=True):
|
|
self.url = url
|
|
self.mobile_emulation = {'deviceName': 'iPad Mini'}
|
|
self.mobile = mobile
|
|
self.headless = headless
|
|
|
|
|
|
def __enter__(self):
|
|
chrome_options = ChromeOptions()
|
|
chrome_options.add_argument('--no-sandbox')
|
|
if self.headless:
|
|
chrome_options.add_argument('--headless')
|
|
if self.mobile:
|
|
chrome_options.add_experimental_option("mobileEmulation", self.mobile_emulation)
|
|
chrome_options.add_argument('user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"')
|
|
start_chrome(self.url, options=chrome_options)
|
|
|
|
return self
|
|
|
|
def __exit__(self, type, value, trace):
|
|
print("type: ", type )
|
|
print("value: ", value)
|
|
kill_browser()
|
|
|
|
@abstractmethod
|
|
def login(self):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def my_assets(self):
|
|
pass |