How to upload file with Selenium WebDriver in Chrome .NET.
Version Chrome (20.0.1132.57). Version chromedriver 22.0.1203.0b
Code:
driver.GetElement(someXpath).SendKeys(filePath)
throws exception:
Element is not clickable at point (144, 90.5). Other element would receive the click: <h2>...</h2>
HTML-code:
<a class="button addfile"> Upload <input class="fileupload" type="file" multiple="" name="files[]"/> </a>
You can force the element to be visible using JavaScript. For the input element, execute JavaScript using the IJavaScriptExecutor, and set the visibility of the element visible, and for good measure, give it some dimensions.
((JavascriptExecutor)driver).ExecuteScript("arguments[0].style.visibility = 'visible';
arguments[0].style.height = '1px'; arguments[0].style.width = '1px';
arguments[0].style.opacity = 1", fileUploadElement);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With