如圖,左邊有一個「選擇檔案」按鈕,按下後會跳出檔案總管讓我選檔案上傳
但是我一直找不到按鈕
語法
driver.find_element_by_xpath('/html/body/form/div[3]/div[2]/main/div/div[2]/table[2]/tbody/tr[2]/td[1]/div/a').click()
錯誤訊息NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"[name="ctl00_ContentPlaceHolder1_tb_totalWeight"]"} (Session info: chrome=100.0.4896.127)
再請各位協助~~謝謝!!
直接把檔案路徑給這個東西就沒問題了
driver.find_element_by_id("ct100_...").send_keys(your_file_path)
不行耶
我剛才用
driver.find_element_by_id("ctl00_ContentPlaceHolder1_FileUpload1").send_keys('/Users/jeng/Documents/Python/test.pdf')
NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"[name="ctl00_ContentPlaceHolder1_tb_totalWeight"]"}
(Session info: chrome=100.0.4896.127)