arabellastrange commited on
Commit
44255d1
·
1 Parent(s): 8026768

basic chrome

Browse files
Files changed (1) hide show
  1. web_search.py +13 -2
web_search.py CHANGED
@@ -8,6 +8,8 @@ import traceback
8
  import urllib.parse as en
9
  import warnings
10
  from itertools import zip_longest
 
 
11
  import requests
12
  import selenium.common.exceptions
13
  from selenium import webdriver
@@ -81,9 +83,18 @@ def process_url(url, timeout):
81
  result = ""
82
  # make driver exec
83
  os.chmod('chromedriver-linux64/chromedriver', stat.S_IEXEC)
84
-
 
 
 
 
 
 
 
 
85
  try:
86
- driver = webdriver.Chrome()
 
87
  logger.info(f"*****setting page load timeout {timeout}")
88
  driver.set_page_load_timeout(timeout)
89
  driver.get(url)
 
8
  import urllib.parse as en
9
  import warnings
10
  from itertools import zip_longest
11
+ from subprocess import check_call, STDOUT
12
+
13
  import requests
14
  import selenium.common.exceptions
15
  from selenium import webdriver
 
83
  result = ""
84
  # make driver exec
85
  os.chmod('chromedriver-linux64/chromedriver', stat.S_IEXEC)
86
+ # apt-get install -y libglib2.0-0=2.50.3-2 \
87
+ # libnss3=2:3.26.2-1.1+deb9u1 \
88
+ # libgconf-2-4=3.2.6-4+b1 \
89
+ # libfontconfig1=2.11.0-6.7+b1
90
+ check_call(['apt-get', 'install', '-y', 'libglib2.0-0=2.50.3-2 \
91
+ libnss3=2:3.26.2-1.1+deb9u1 \
92
+ libgconf-2-4=3.2.6-4+b1 \
93
+ libfontconfig1=2.11.0-6.7+b1'],
94
+ stdout=open(os.devnull, 'wb'), stderr=STDOUT)
95
  try:
96
+ driver = webdriver.Chrome(service=ChromeService(executable_path='chromedriver-linux64/chromedriver'),
97
+ options=options)
98
  logger.info(f"*****setting page load timeout {timeout}")
99
  driver.set_page_load_timeout(timeout)
100
  driver.get(url)