user9990064
user9990064

Reputation: 9

I am not able to upload files in selenium webdriver

I am not able to upload files in selenium webdriver .... My code is here: : driver.FindElement(By.XPath("/html/body/div[2]/div[5]/div/div/div/div[2]/div[2]/div[1]/div/div[1]")).SendKeys ("E:/QA/upload test pictures/dreamstime_xl_11004542-Copy.jpg");

**I am getting error ** : System.InvalidOperationException: 'unknown error: cannot focus element

Upvotes: 0

Views: 605

Answers (1)

MivaScott
MivaScott

Reputation: 1806

You can't .SendKeys() to a div element. Look for the <input> tag instead.

Upvotes: 0

Related Questions