File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
import re
3
3
import requests
4
- from bs4 import BeautifulSoup
4
+ import os
5
5
6
+ from bs4 import BeautifulSoup
6
7
from selenium import webdriver
7
8
from selenium .webdriver .common .action_chains import ActionChains
8
- from selenium .webdriver .chrome .options import Options
9
- from selenium .webdriver .common .by import By
10
9
11
10
class UsernameError (Exception ):
12
11
pass
@@ -256,14 +255,16 @@ def __interviewbit(self):
256
255
def __leetcode (self ):
257
256
url = 'https://leetcode.com/{}' .format (self .__username )
258
257
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" )
261
263
262
264
#driver = webdriver.PhantomJS(executable_path='./phantomjs')
263
265
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 )
267
268
268
269
hover_ranking = driver .find_element_by_class_name ('ranking' )
269
270
ActionChains (driver ).move_to_element (to_element = hover_ranking ).perform ()
You can’t perform that action at this time.
0 commit comments