Sep-07-2022, 05:13 PM
Hi,
the UI freezes when apply the following code to the tkinter
the UI freezes when apply the following code to the tkinter
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from utilities.dictionary import Predefined
import time
import multiprocessing
from itertools import product
x = ['http://google.com', 'http://yahoo.com', 'http://bing.com']
y = ['weight loss tips', 'weight loss plan', 'weight loss diet', 'weight loss workouts', 'weight loss plan for a month', 'weight loss']
def merge_names(a, b):
print(a)
print(b)
# return '{} & {}'.format(a, b)
options = Options()
options.binary_location = r'drivers/browser/chrome.exe'
driver = webdriver.Chrome(executable_path=r'drivers/chromedriver.exe', options=options)
driver.get(a)
do = Predefined(driver)
time.sleep(5)
do.typeinput('//input[@name="q"] | //input[@name="p"]', b)
time.sleep(10)
driver.close()
driver.quit()
if __name__ == '__main__':
with multiprocessing.Pool(processes=3) as pool:
results = pool.starmap(merge_names, product(x, y))Any Help Would be Appreciated, Thanks
