Skip to content

Commit

Permalink
selenium: fix logger
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Oct 25, 2023
1 parent 55bbf68 commit 54902cd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
5 changes: 3 additions & 2 deletions automon/integrations/seleniumWrapper/actions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from selenium.webdriver.common.action_chains import ActionChains

from automon.log import Logging
from automon.log import logger

log = Logging(name='SeleniumActions', level=Logging.INFO)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.INFO)


class SeleniumActions:
Expand Down
12 changes: 6 additions & 6 deletions automon/integrations/seleniumWrapper/browser_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from selenium.webdriver import Safari
from selenium.webdriver import WebKitGTK

from automon.log import Logging
from automon.log import logger

from .config import SeleniumConfig

Expand All @@ -23,8 +23,8 @@
from selenium.webdriver import Chrome as ChromiumEdge
from selenium.webdriver import Chrome as WPEWebKit

log = Logging(name='SeleniumBrowserType', level=Logging.DEBUG)

log = logger.logging.getLogger(__name__)
log.setLevel(logger.DEBUG)

class SeleniumBrowserType(object):
config: SeleniumConfig
Expand Down Expand Up @@ -52,7 +52,7 @@ def chrome(self, options: list = None) -> Chrome:
return self.webdriver.Chrome(executable_path=self.chromedriver, options=chrome_options)
return self.webdriver.Chrome(options=chrome_options)
except Exception as e:
log.error(f'Browser not set. {e}', enable_traceback=False)
log.error(f'Browser not set. {e}')

def chrome_headless(self, options: list = None, **kwargs) -> Chrome:
"""Chrome headless
Expand Down Expand Up @@ -80,7 +80,7 @@ def chrome_headless(self, options: list = None, **kwargs) -> Chrome:
return self.webdriver.Chrome(self.chromedriver, options=chrome_options, **kwargs)
return self.webdriver.Chrome(options=chrome_options, **kwargs)
except Exception as e:
log.error(f'Browser not set. {e}', enable_traceback=False)
log.error(f'Browser not set. {e}')

@property
def chromium_edge(self, options: list = None, **kwargs) -> ChromiumEdge:
Expand All @@ -98,7 +98,7 @@ def chromium_edge(self, options: list = None, **kwargs) -> ChromiumEdge:
return self.webdriver.ChromiumEdge(self.chromedriver, options=chromium_options, **kwargs)
return self.webdriver.ChromiumEdge(options=chromium_options, **kwargs)
except Exception as e:
log.error(f'Browser not set. {e}', enable_traceback=False)
log.error(f'Browser not set. {e}')

def edge(self, **kwargs) -> Edge:
"""Edge"""
Expand Down
5 changes: 3 additions & 2 deletions automon/integrations/seleniumWrapper/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import selenium.webdriver

from automon.log import Logging
from automon.log import logger

from .config_webdriver import ConfigWebdriver

log = Logging(name='SeleniumConfig', level=Logging.INFO)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.DEBUG)


class SeleniumConfig(object):
Expand Down
7 changes: 4 additions & 3 deletions automon/integrations/seleniumWrapper/config_webdriver.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import selenium.webdriver

from automon.log import Logging
from automon.log import logger

from .config_webdriver_chrome import ConfigChrome

log = Logging(name='ConfigWebdriver', level=Logging.INFO)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.DEBUG)


class ConfigWebdriver(object):
Expand Down Expand Up @@ -80,7 +81,7 @@ def run(self):
try:
return self.webdriver_wrapper.run()
except Exception as e:
log.error(f'failed to run: {e}', enable_traceback=False)
log.error(f'failed to run: {e}')

def start(self):
"""alias to run"""
Expand Down
5 changes: 3 additions & 2 deletions automon/integrations/seleniumWrapper/user_agents.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import random

from automon import Logging
from automon.log import logger

log = Logging(name='SeleniumUserAgentBuilder', level=Logging.DEBUG)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.DEBUG)


class SeleniumUserAgentBuilder:
Expand Down

0 comments on commit 54902cd

Please sign in to comment.