Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element with locator not found in page pop up

The Selenium is not found this element:

<div class="import-file">
     <input name="ctl00$MainContent$btnAttachment" type="button" id="MainContent_btnAttachment" class="button-norl img-upload-text b" value="แนบไฟล์">
     <input type="file" name="ctl00$MainContent$fuAttachment" id="MainContent_fuAttachment" onchange="akUploadfile('[id$=fuAttachment]',$('[id$=hdnFileType1]').val());">
</div>

My robot code:

VA_M03_0108
[Tags]  Carregis
Login.Input user name   ${USER}         ${PASS}
SendCar
Click Element       id=ContentPlaceHolder1_rpt_search_lblCarReceiveDoc_0
Sleep  2s
Wait Until Element Is Visible     id=UpdatePanel1         timeout=20s
Choose File        id=MainContent_fuAttachment     ${CURDIR}/ใบรับรถ.jpg

The robot response:

Element 'id=MainContent_fuAttachment' not visible after 20 seconds.

Anyone, please help me. This is the UI: https://www.sendspace.com/file/kqerdt

like image 845
Suratchana Sriraksa Avatar asked Nov 16 '18 08:11

Suratchana Sriraksa


1 Answers

First of all, if you're checking for an element within a POP-UP windows, first you have to select the newly popped-up window with "Select window". After this is covered, try checking if the page contains the element. If it does, try checking for any visibility attribute that could prevent it from being displayed on the screen. A transparent object sitting on top of the searched object could also make the visibility check fail (imho visibility checks on Robotframework are a really obscure matter).

For debugging, add a capture page screen shot just after the sleep and check yourself visually for the state in which the page finds itself at that moment.

like image 91
Fernando Prado Avatar answered Oct 13 '22 11:10

Fernando Prado