我有以下用于文件上傳的 HTML。<div class="drop-zone hand-cursor ng-pristine ng-untouched ng-valid ng-empty" ngf-select="" ngf-drop="" data-ngf-pattern=".pdf" data-ngf-accept="application/pdf" data-ng-model="vm.siteVo.signed_order_form"> <!-- ngIf: !vm.siteVo.signed_order_form --> <div ng-if="!vm.siteVo.signed_order_form" class="ng-scope"><i class="material-icons primary-color font-size-40">backup</i> <br><span class="color54 font-size-16 ng-binding">Drag and drop file here or click to open explorer</span></div> <!-- end ngIf: !vm.siteVo.signed_order_form --> <!-- ngIf: vm.siteVo.signed_order_form --></div>我嘗試了以下方法來定位driver.find_element_by_css_selector(".drop-zone > .ng-scope").send_keys("file path")但出現(xiàn)以下錯誤selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable (Session info: chrome=77.0.3865.90)
1 回答

阿波羅的戰(zhàn)車
TA貢獻1862條經(jīng)驗 獲得超6個贊
已解決:input
withtype
file
不在同一個div
頁面中,而是隨機放置在頁面中。使用 xpath 定位并直接使用send_keys()
添加回答
舉報
0/150
提交
取消