refactor: simplify driver init wait; clarify TMWebDriver master error msg
This commit is contained in:
1 parent
afcb6a47af
commit
e4a12dde2b
2 files changed
+4
-7
No files matched your search
+1
-1
@@ -245,7 +245,7 @@ class TMWebDriver:
|
||||
def _remote_cmd(self, cmd):
|
||||
try: return requests.post(self.remote, headers={"Content-Type": "application/json"}, json=cmd, timeout=30).json()
|
||||
except (ConnectionError, requests.exceptions.ConnectionError):
|
||||
raise ConnectionError("TMWebDriver master未运行,看tmwebdriver_sop启动master")
|
||||
raise ConnectionError("TMWebDriver master未运行,看tmwebdriver_sop后台启动一个TMWebDriver")
|
||||
|
||||
def get_all_sessions(self):
|
||||
if self.is_remote:
|
||||
|
||||
@@ -108,14 +108,11 @@ def first_init_driver():
|
||||
global driver
|
||||
from TMWebDriver import TMWebDriver
|
||||
driver = TMWebDriver()
|
||||
for i in range(20):
|
||||
time.sleep(1)
|
||||
for i in range(7):
|
||||
time.sleep(2)
|
||||
sess = driver.get_all_sessions()
|
||||
if len(sess) > 0: break
|
||||
if len(sess) == 0: return
|
||||
if len(sess) == 1:
|
||||
#driver.newtab()
|
||||
time.sleep(3)
|
||||
if i == 4: os.startfile("https://example.com")
|
||||
|
||||
def web_scan(tabs_only=False, switch_tab_id=None, text_only=False, maxlen=35000):
|
||||
"""获取当前页面的简化HTML内容和标签页列表。注意:简化过程会过滤边栏、浮动元素等非主体内容。
|
||||
|
||||
Reference in new issue
Block a user