Created
May 27, 2016 17:11
-
-
Save kurozumi/db763537c03d2ebbc3f53e1485e207c2 to your computer and use it in GitHub Desktop.
【Python】Seleniumを使ってマルチスレッドでFirefoxを起動する方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import threading | |
def browser1(): | |
url = "https://www.google.co.jp", | |
browser = webdriver.Firefox() | |
browser.get(url) | |
browser.close() | |
def browser2(): | |
url = "http://www.yahoo.co.jp", | |
browser = webdriver.Firefox() | |
browser.get(url) | |
browser.close() | |
if __name__ == "__main__": | |
th1 = threading.Thread(target=browser1) | |
th2 = threading.Thread(target=browser2) | |
th1.start() | |
th2.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment