python3.x - python多进程,不能在同一窗口吗
阿神
阿神 2017-04-18 10:25:42
0
2
669
web=webdriver.Firefox()
web.get()

def work1():
    pass
def work2():
    pass
def work3():
    pass

w1 = Process(target=work1,name='w1')
w2 = Process(target=work2,name='w2')
w3 = Process(target=work3,name='w3')

w1.start()
w2.start()
w3.start()

这样web.get()会打开一个firefox. 三个进程也打开三个firefox。
这下就四个了。
我是想能不能让它们只打开一个firefox工作???

(不用线程)
(语法不是问题的重点,只是说明问题随手打的)

阿神
阿神

闭关修行中......

reply all(2)
左手右手慢动作

Can’t.
The questioner means to use multi-threading to obtain web page information. However, an HTML document must occupy a window. Modern browsers use tabs to solve this problem. Then the questioner can set the default use of tabs to open the window in Firefox.
Also, all windows should be opened in the main thread, and then the window objects should be passed to the child process. Otherwise, Firefox will think that it is being called by multiple processes.

阿神

Can you open multiple tabs?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template