Skip to content

Commit

Permalink
fix arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
alpha-xone committed Nov 27, 2020
1 parent 8726c71 commit 141c692
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions xone/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,23 @@ def to_text(soup, elem_name, func: callable = None) -> list:
]


def get_browser(browser, headless=True):
def get_browser(browser, headless=True, *args):
"""
Get browser
"""
br, br_opt = BROWSERS[browser]
if headless: br_opt.add_argument('--headless')
br_opt.add_argument('--disable-gpu')
for arg in args: br_opt.add_argument(arg)
return br(options=br_opt)


def page_source(
url: str,
browser: str = '',
click: str = '',
headless=True
headless=True,
*args
) -> PageSource:
"""
Page source from url
Expand Down Expand Up @@ -84,7 +86,7 @@ def page_source(
f'Valid browsers: {list(BROWSERS.keys())}.'
)

with get_browser(browser, headless=True) as driver:
with get_browser(browser, headless=headless, *args) as driver:
driver.get(url=url)
if click:
try:
Expand Down

0 comments on commit 141c692

Please sign in to comment.