Selenium + Python - how to get the response from the site after uploading an image -
i'm trying upload images microsoft's http://how-old.net/ api compare our age , gender classification algorithm [1].
i've managed upload images site, can't figure out how response (i.e. age , gender classifications).
here code:
from selenium import webdriver selenium.webdriver.common.keys import keys driver = webdriver.firefox() driver.get("http://how-old.net/") file_input=driver.find_element_by_id("uploadbtn") driver.execute_script("arguments[0].style = {visibility: 'visible'};", file_input) = file_input.send_keys("d:\\adiencefaces\\aligned\\7153718@n04\\landmark_aligned_face.2282.11597935265_29bcdfa4a5_o.jpg") is there way prediction?
thanks in advance! gil
[1] levi, gil, , tal hassner. "age , gender classification using convolutional neural networks."
edit: added wait commands , other code lines, still returns none:
from selenium import webdriver selenium.webdriver.common.keys import keys import time driver = webdriver.firefox() driver.get("http://how-old.net/") time.sleep(60) file_input=driver.find_element_by_id("uploadbtn") driver.execute_script("arguments[0].style = {visibility: 'visible'};", file_input) file_input.send_keys("d:\\adiencefaces\\aligned\\7153718@n04\\landmark_aligned_face.2282.11598166203_c70bb34c80_o.jpg") time.sleep(60) ages = driver.execute_script("function get_ages() { arr=[]; $('#faces .tooltip-inner div').each(function () { arr.push($(this).text()); }); return arr;}; get_ages();") print ages
try:
ages = driver.execute_script("function get_ages() { arr=[]; $('#faces .tooltip-inner div').each(function () { arr.push($(this).text()); }); return arr;}; return get_ages()") cheers.
Comments
Post a Comment