Upload file using HTTP in WebDriver

I am trying to use WebDriver to navigate an https site and upload a file using WebDriver. When I did it like this, a file download dialog appeared.

WebDriver driver = new ChromeDriver();
driver.get("http://xxx/file1.txt");

I am wondering if there is a way to simply invoke a method in WebDriver to upload a file using a regular https request without simulating a click?

Thanks in advance.

+5
source share
2 answers

, , . , (Firefox Chrome) . - , , Selenium. HTTP- . Java HttpClient Apache; .NET HttpWebRequest . , , , , HTTP-.

, , , , HTTP- . , .

+8

, . Chromedriver:

profile = Selenium::WebDriver::Chrome::Profile.new
profile['download.prompt_for_download'] = false
profile['download.default_directory'] = download_directory

. , , - .

: http://peter.sh/experiments/chromium-command-line-switches/

+6

All Articles