[問題] Robot Framework 上傳檔案 (MAC)

看板Python作者 (鬼艾倫)時間5年前 (2019/05/13 18:24), 編輯推噓1(102)
留言3則, 2人參與, 5年前最新討論串1/1
大家下午安,這個問題困繞我一整天,stackoverflow 看起來也沒解法, 請大家幫幫忙想辦法 >.< *** Settings *** Library Collections Library Selenium2Library *** Variables *** ${file_path} ${CURDIR}/file/IMG_0738.jpg *** Test Cases *** Case Run Keywords PreconditionLogin ... AND MyKeyword *** Keywords *** PreconditionLogin ${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver Call Method ${chrome_options} add_argument --disable-extensions Call Method ${chrome_options} add_argument --headless Call Method ${chrome_options} add_argument --disable-gpu Call Method ${chrome_options} add_argument --no-sandbox Create Webdriver Chrome chrome_options=${chrome_options} Set Window Size 1024 768 Go To 10.11.14.7 Input Text //*[@id='UserID'] aaa Input Text //*[@id='Password'] 123 Press Key //*[@id='Password'] \\13 MyKeyword Wait Until Element Is Visible //*[@class='UploadInput-btn btn'][contains(text(),'UploadFile')] 1s Choose File //*[@class='UploadInput-btn btn'][contains(text(),'UploadFile')] ${file_path} 大概是上述的內容,但是執行後卻有 error: ElementNotInteractableException: Message: element not interactable 問題是我如果直接 Click Element //*[@class='UploadInput-btn btn'][contains(text(),'UploadFile')] 是可以成功的... 爬了超多文章都沒有相關解法...不知道大家有啥頭緒嗎? P.S. 這個上傳的 locator 是放在某個滑出的頁面中, 也沒有 visible 或 enabled 的問題...苦惱 ing -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.147.214.186 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1557743089.A.8B5.html

05/14 20:55, 5年前 , 1F
hover?
05/14 20:55, 1F

05/15 15:16, 5年前 , 2F
找到原因了,xpath 要用input的locator...而不能用but
05/15 15:16, 2F

05/15 15:16, 5年前 , 3F
ton
05/15 15:16, 3F
文章代碼(AID): #1SsKNnYr (Python)