简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM