Skip to content

Commit

Permalink
added option to specify the download path
Browse files Browse the repository at this point in the history
  • Loading branch information
nateshmbhat committed Oct 4, 2020
1 parent 0d294cb commit 085bfe3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@



VERSION="0.33"
VERSION="0.34"


with open('README.rst', 'r', encoding='utf-8') as f:
Expand Down
10 changes: 9 additions & 1 deletion webbot/webbot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import re
import string
import errno
import sys
from collections import OrderedDict

Expand Down Expand Up @@ -36,10 +37,17 @@ class Browser:
- List containing all the errors which might have occurred during performing an action like click ,type etc.
"""

def __init__(self, showWindow=True, proxy=None):
def __init__(self, showWindow=True, proxy=None , downloadPath:str=None):
options = webdriver.ChromeOptions()
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--no-sandbox")
if downloadPath is not None and isinstance(downloadPath,str):
absolutePath = os.path.abspath(downloadPath)
if(not os.path.isdir(absolutePath)):
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), absolutePath)

options.add_experimental_option('prefs', {'download.default_directory' : absolutePath})

if proxy is not None and isinstance(proxy, str):
options.add_argument("--proxy-server={}".format(proxy))

Expand Down

0 comments on commit 085bfe3

Please sign in to comment.