我無法使用 selenium 將文件上傳到 shopify .. Selenium 似乎找不到我需要將文件添加到的輸入元素,我假設它與 input type=hidden 部分有關?見圖片。我已經(jīng)嘗試了很多這樣的變化WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='files_']"))).send_keys("DIR/myfile.pdf')并嘗試執(zhí)行腳本以嘗試取消隱藏輸入container = browser.find_element_by_xpath("//input[@type='hidden']")browser.execute_script("arguments[0].type = 'text';", container)等等等等shopifyapi 的文檔不是最好的,我也不是最好的編碼器。任何幫助將不勝感激。謝謝!
1 回答

大話西游666
TA貢獻1817條經(jīng)驗 獲得超14個贊
要上傳文件,您必須將密鑰發(fā)送到input
with 類型file
,通常它是隱藏的。替換element_to_be_clickable
為presence_of_element_located
并嘗試發(fā)送如下代碼中的密鑰:
WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "input#files_"))).send_keys("DIR/myfile.pdf')
添加回答
舉報
0/150
提交
取消