I am new automation and I am using selenium with python and got stuck.

I am trying to upload the document using sendkeys in selenium but getting this error.

Error -selenium.common.exceptions.WebDriverException: Message: unknown error: cannot focus element.

Section where i am trying to upload the document ::

Upload document GUI

Below is the html code:

<spane class="uk-form-file md-btn" style="width:70%;height: 50%">
                                                Upload Document
<input type="file" ngf-select="" id="picture_ids" class="md-input ng-pristine ng-invalid ng-invalid-required ng-touched" onchange="angular.element(this).scope().imageUpload(this.files,'picture','document')" name="picture" ng-model="statusUpdate.document" style="width: 100%;" ng-required="true" required="required">

and corresponding Selenium code:

uploaddoc=wait.until(EC.presence_of_element_located((By.XPATH, "//spane[@class='uk-form-file md-btn']")))
  • Your HTMl code has syntax error its like <spane>. Is there any <spane/> tag actual sytax is <span/> Aug 21, 2020 at 10:00
  • Thanks @MohamedSulaimaanSheriff Aug 21, 2020 at 10:47

1 Answer 1


You are trying to sendKEys to a span element ,

instead you have to use input element.

try using :

uploaddoc=wait.until(EC.presence_of_element_located((By.XPATH, "//input[@id='picture_ids']")))
  • 1
    thanks @PDHide . its working. Aug 21, 2020 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.