M
M
martensit2019-01-22 11:39:21
Google Chrome
martensit, 2019-01-22 11:39:21

How to upload image to website via c# selenium chromedriver?

When you click on the button on the web page, a standard file upload window appears. Interested in the most universal way, suitable for most sites.

wd.FindElement(By.XPath("//button[.='Загрузить фото']")).Click();
new Actions(wd).SendKeys(@"C:\000.jpg").Build().Perform();
new Actions(wd).SendKeys(OpenQA.Selenium.Keys.Enter).Build().Perform();

Tried that, but doesn't work.
6548567986.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2019-01-22
@MrMureno

why did you open the dialog? it is systemic..
you just need to substitute the path, as if it was opened and returned the path..
well, you can also google it in English))
quite sensibly with a bunch of examples.. at the very first link.
https://stackoverflow.com/questions/8851051/seleni...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question