python - How can we wait for a message text to pop up in selenium -


i have selenium application contains uploads file function gets called recursively after every upload on website

problem:

the function being called , not waiting upload done. messing whole application process. know can add time.sleep() not know size of files , how long upload take. prefer add check see if files uploaded

my solution

luckily me successful message pops when uploads done

enter image description here

so decided add success_element waits success message pop out seen in code below

def upload(driver, filenum, filepath):       #click ok upload       ok_link = driver.find_element_by_class_name("borderbutton")       ok_link.click()       #wait success message pop out( fails )       success_wait = webdriverwait(driver, 1200)       success_element =   success_wait.until(ec.visibility_of_element_located(by.link_text("file(s) have(s) been uploaded successfully!")))       #call function again upload more after succesful message pops out       upload(driver, filenum, filepath) 

error:

i got error below right after first group of files uploaded, because did not find success message right away, not supposed anyway , thought wait after upload done 1200 seconds (roughly 20 minutes max)

how can solve problem. other solutions ?

success_element = success_wait.until(ec.visibility_of_element_located(by.link_text("file(s) have(s) been uploaded successfully!"))) typeerror: 'str' object not callable

for whom had same issue found solution, , using ec.presence_of_element_located instead. waits element located or throws error after 20 minutes

success_wait = webdriverwait(driver, 1800) success_element = success_wait.until(ec.presence_of_element_located((by.id, "successmessage"))) 

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -