1

The page that I worked on has invisible hidden option button, I used 'EC.element_to_be_clickable'. This code is working, but this is only button's click and downloading by firefox... I want to get video's link url.

_sDriver = webdriver.Firefox()
_sDriver.get('www.example.com/video')

wait = WebDriverWait(_sDriver, 10)
download_menu = _sDriver.find_element_by_id("download-button")
action = ActionChains(_sDriver)
action.move_to_element(download_menu).perform()

documents = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "sample_video")))
documents.click()

my code's result is downloading by firefox, but I want to download using python. example-

subprocess.call('wget {0}'.format(documents_url))

how do I get documents's url? thanks for your help.

User8392
  • 93
  • 1
  • 12
  • As I know there is no simple way to do it, but you can find some ideas here http://stackoverflow.com/questions/6509628/how-to-get-http-response-code-using-selenium-webdriver-with-java – El Ruso Jan 14 '17 at 11:28
  • if you can find this element then see what you have in this element - maybe there is your url and you can simple get it (using selenium, lxml, or standard string functions). But every page is different then there is no one universal solution. – furas Jan 14 '17 at 13:02
  • 1
    did you try `wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "sample_video"))).get_attribute('href')`? – Andersson Jan 14 '17 at 15:31
  • @Adnersson oh, I got it! thanks! – User8392 Jan 15 '17 at 02:06

0 Answers0