簡體   English   中英

如何使用xpath作為sendkey從硒中以只讀文本格式上載文件將不起作用

[英]How to upload file in readonly text from selenium using xpath as sendkeys won't work

這是結構:

<input _ngcontent-c9="" class="form-field" placeholder="Upload Emote" readonly="" type="text">

我已使用以下代碼上傳文件,但sendkeys無效,並且沒有收到任何錯誤但無法上傳。

    WebElement uploadingEmote = adminDriver.findElement(By.xpath("//input[@placeholder='Upload Emote']"));
    uploadingEmote.sendKeys("/home/smart/Downloads/EMO/(Heart).png");

但是上面的代碼不起作用,因為該字段是只讀的。 任何幫助,將不勝感激。

這是屏幕截圖:

<input _ngcontent-c9="" class="form-field" placeholder="Upload Emote" readonly="" type="text">

如果要上傳文件,則輸入字段的類型應為“文件”類型

<input type="file" name="fileToUpload" id="fileToUpload">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM