Your Name 3 tahun lalu
induk
melakukan
731ece8a18
3 mengubah file dengan 6 tambahan dan 3 penghapusan
  1. 1 0
      hhh/browser_common.py
  2. 2 1
      tests/sel_client.py
  3. 3 2
      tests/selserver.py

+ 1 - 0
hhh/browser_common.py

@@ -9,6 +9,7 @@ import sys
 import os
 import time
 import re
+import json
 
 class JBrowser:
     def __init__(self):

+ 2 - 1
tests/sel_client.py

@@ -3,5 +3,6 @@ import time
 
 conn = rpyc.connect("139.162.121.30", 12345)
 x = conn.root.get_url('https://data.similarweb.com/api/v1/data?domain=yahoo.com.tw')
-
+print(x)
+#drv=conn.root.get_driver()
 time.sleep(9999)

+ 3 - 2
tests/selserver.py

@@ -1,5 +1,5 @@
 import sys
-
+import json
 sys.path.insert(0,'./kw_tools/web')
 import browser_common
 
@@ -17,7 +17,8 @@ class MyService(rpyc.Service):
         self.jb.get(url)
         driver=self.jb.get_driver()
         src=driver.page_source
-        return src
+        return json.loads(driver.find_element_by_tag_name('body').text)
+#        return src
 
     def exposed_get_driver(self):
         return self.jb.get_driver()