|
@@ -1,9 +1,9 @@
|
|
|
from selenium import webdriver
|
|
|
import time
|
|
|
-import networkx as nx
|
|
|
-import dataset
|
|
|
-import pickle
|
|
|
-import codecs
|
|
|
+#import networkx as nx
|
|
|
+#import dataset
|
|
|
+#import pickle
|
|
|
+#import codecs
|
|
|
from selenium.webdriver.common.keys import Keys
|
|
|
import sys
|
|
|
import os
|
|
@@ -12,15 +12,20 @@ import re
|
|
|
|
|
|
class JBrowser:
|
|
|
def __init__(self):
|
|
|
- os.chdir("C:\\Program Files\\Google\\Chrome\\Application\\")
|
|
|
+ if os.name=='nt':
|
|
|
+ os.chdir("C:\\Program Files\\Google\\Chrome\\Application\\")
|
|
|
|
|
|
|
|
|
def set_profile_path(self,profilepath):
|
|
|
self.profilepath=profilepath
|
|
|
option = webdriver.ChromeOptions()
|
|
|
option.add_argument('--disable-web-security')
|
|
|
- option.add_argument('--allow-running-insecure-content')
|
|
|
- option.add_argument("--user-data-dir=C:\\Users\\jared\\AppData\\Local\\Google\\Chrome\\User Data\\"+self.profilepath+"\\")
|
|
|
+ option.add_argument('--allow-running-insecure-content')
|
|
|
+ if os.name=='nt':
|
|
|
+ option.add_argument("--user-data-dir='C:\\Users\\jared\\AppData\\Local\\Google\\Chrome\\User Data\\"+self.profilepath+"\\'")
|
|
|
+ else:
|
|
|
+ option.add_argument("--user-data-dir="+self.profilepath)
|
|
|
+
|
|
|
self.option=option
|
|
|
driver = webdriver.Chrome(options=option)
|
|
|
self.driver=driver
|