1 回答
TA贡献1789条经验 获得超10个赞
最好的办法是并行。我知道一种方法,但可能有更有效的方法来做到这一点。
import threading
from sys.stdout import flush
from sys import argv
from selenium import webdriver
website_loaded = False
def loading():
while not website_loaded:
print("Loading.\r")
flush()
print("Loading..\r")
flush()
print("Loading...\r")
flush()
driver = mydriverslocation
website = argv[1]
# Start the loading thread
# Expected method to run, and arguments.
loading_thread = threading.Thread(loading, ())
loading_thread.start()
driver.get(website)
# And any other code while loading
# This will pass to the thread
website_loaded = True
添加回答
举报
