0
votes

With Selenium Webdriver in Python I open a webpage and I click on a "file upload" form (is HTML5, it is a DIV, it isn't a form HTML element but it doesn't care a lot), the problem comes after clicking it, a "File Open" window comes up and ask for a file. Now is when I want to put the file path and press Enter key (or click 'Open' button) with AutoIt.

But I can't do that with WinActivate because seems like AutoIt finds it but it just isn't right, because the Handle that AutoIt gives me is not equal to the Handle that I see with the AutoIt Window Info tool.

$title = 'Open'
WinActivate($dialogtitle)
If WinActive($dialogtitle) Then
    MsgBox(0, "Found", "Window found.")
    send("D:\documents\photo.jpg")
    Send("{ENTER}")
Else
    MsgBox(0, "Not found", "Window not found.")
EndIf

It works perfect on Firefox but it doesn't on Chrome and MS Edge.

1

1 Answers

0
votes

This may be late , but this is how i do it , change "Open File" with the text that appears on your window

import autoit
autoit.win_wait_active("Open File", 5)
autoit.send(path)
autoit.send("{ENTER}")