Your Name 3 年 前
コミット
c891315ed8
1 ファイル変更11 行追加5 行削除
  1. 11 5
      hhh/browser_common.py

+ 11 - 5
hhh/browser_common.py

@@ -19,17 +19,23 @@ class JBrowser:
         os.chdir("C:\\Program Files\\Google\\Chrome\\Application\\")
         home = expanduser("~")
         print(home)
-#        config = configparser.ConfigParser()
-#        config.read_file(open('defaults.cfg'))
-#        config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],
-#                    encoding='cp1250')
+        config = configparser.ConfigParser()
+        content=config.read_file(open(home+'\\test.cfg'))
+        print(content)
+        print(config['DEFAULT'])
+        print(config.sections())
+        self.userdir=config['DEFAULT'].get('userdir')
+
 
     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("--user-data-dir="+self.userdir+profilepath+"\\")
+
+#        option.add_argument("--user-data-dir=C:\\Users\\jared\\AppData\\Local\\Google\\Chrome\\User Data\\"+self.profilepath+"\\")
         self.option=option
         driver = webdriver.Chrome(options=option)
         self.driver=driver