【发布时间】:2020-12-28 14:29:31
【问题描述】:
我想同时运行代码两次以节省时间。我是一个初学者,我正在对此进行一些研究,并获得了多线程这个词并听说了 pytest 库,但我不知道该怎么做,甚至我找不到示例代码。 请帮我!我在等你的答复
import selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from shutil import which
import time
import pandas as pd
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
Links = []
chrome_path = which('chromedriver')
driver = webdriver.Chrome(executable_path=chrome_path)
driver.maximize_window()
driver.get('https://www.google.com')
text = driver.find_element_by_xpath('//input[@class="gLFyf gsfi"]')
text.send_keys('Hello')
driver.find_element_by_xpath('//div[@class="FPdoLc tfB0Bf"]//input[1]').click()
time.sleep(3)
driver.close()
我想同时跑两次?谁来帮帮我
【问题讨论】:
-
为什么不使用多线程?
标签: java python selenium selenium-webdriver