当前位置: 动力学知识库 > 问答 > 编程问答 >

Selenium Python Hangs at click()

问题描述:

Hello everyone i'm trying to make a bot that uploads a file and reads the percentage of the upload bar. I already have the code to read the percentage, but when i actually click on the upload button it hangs until it is fully uploaded.

driver.find_element_by_css_selector("Upload").click()

while 1:

driver.find_element_by_css_selector("Percentage").text

I have also tried using threads (This is my first time using threads) and it seems to work the same as just calling the function.

def get_percent():

while 1:

testy = driver.find_element_by_css_selector("Percentage").text

print testy

def start_upload():

driver.find_element_by_css_selector("Upload").click()

w = threading.Thread(name='get_percent', target=get_percent())

e = threading.Thread(name='start_upload', target=start_upload())

e.start() #It will hang on upload

w.start()

#if i do it like this instead it will hang in my get_percent function

#w.start()

#e.start()

How do i get around this? Please help

分享给朋友:
您可能感兴趣的文章:
随机阅读: