请帮助!我想打开几个Webdriver,并且每个操作都需要执行不同的操作,例如第一次打开WebDriver进行登录,第二次注册等。我尝试使用Pool库,但是它无法正常工作,它打开的Paraller并不平行。 >
from multiprocessing import Pool
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
class C:
def log(self, url):
print("1")
chrome_options = Options()
chrome_options.add_argument("--start-maximized")
driver = webdriver.Chrome("C:/Users/path")
driver.get(url)
def reg(self, url):
print("2")
chrome_options = Options()
chrome_options.add_argument("--start-maximized")
driver = webdriver.Chrome("C:/Users/path")
driver.get(url)
def f(self, *name):
return name
def run(self):
pool = Pool(processes=2)
pool.map(self.f, (self.log("someurl?form=sign_in"), self.reg("someurl?form=sign_up")))
if __name__ == '__main__':
c = C()
c.run()