Skip to content

Commit 80df69e

Browse files
committedOct 2, 2020
fixed: heroku chromedriver bug
1 parent 5d2d0b2 commit 80df69e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed
 

‎chromedriver

4.48 MB
Binary file not shown.

‎details_soup.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import json
22
import re
33
import requests
4-
from bs4 import BeautifulSoup
4+
import os
55

6+
from bs4 import BeautifulSoup
67
from selenium import webdriver
78
from selenium.webdriver.common.action_chains import ActionChains
8-
from selenium.webdriver.chrome.options import Options
9-
from selenium.webdriver.common.by import By
109

1110
class UsernameError(Exception):
1211
pass
@@ -256,14 +255,16 @@ def __interviewbit(self):
256255
def __leetcode(self):
257256
url = 'https://leetcode.com/{}'.format(self.__username)
258257

259-
options = Options()
260-
options.headless = True
258+
options = webdriver.ChromeOptions()
259+
options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
260+
options.add_argument("--headless")
261+
options.add_argument("--disable-dev-shm-usage")
262+
options.add_argument("--no-sandbox")
261263

262264
#driver = webdriver.PhantomJS(executable_path='./phantomjs')
263265

264-
driver = webdriver.Chrome(options=options, executable_path='./chromedriver')
265-
action = ActionChains(driver)
266-
driver.get(url)
266+
driver = webdriver.Chrome(options=options, executable_path=os.environ.get("CHROMEDRIVER_PATH"))
267+
driver.get(url)
267268

268269
hover_ranking = driver.find_element_by_class_name('ranking')
269270
ActionChains(driver).move_to_element(to_element=hover_ranking).perform()

0 commit comments

Comments
 (0)
Please sign in to comment.