Robot Framework - Locating input element with accept attribute fails











up vote
0
down vote

favorite












I am writing an automation script for an avatar upload module with the following CSS locator:



input[accept="image/png,image/jpeg,image/gif,image/bmp"]


I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:



Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.


Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?










share|improve this question


















  • 1




    The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with Page Should Contain Element.
    – Todor
    Nov 20 at 5:07










  • @Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
    – jeffsia
    Nov 20 at 5:27















up vote
0
down vote

favorite












I am writing an automation script for an avatar upload module with the following CSS locator:



input[accept="image/png,image/jpeg,image/gif,image/bmp"]


I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:



Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.


Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?










share|improve this question


















  • 1




    The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with Page Should Contain Element.
    – Todor
    Nov 20 at 5:07










  • @Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
    – jeffsia
    Nov 20 at 5:27













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am writing an automation script for an avatar upload module with the following CSS locator:



input[accept="image/png,image/jpeg,image/gif,image/bmp"]


I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:



Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.


Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?










share|improve this question













I am writing an automation script for an avatar upload module with the following CSS locator:



input[accept="image/png,image/jpeg,image/gif,image/bmp"]


I am using Robot Framework's Wait Until Element Is Visible keyword to look for the locator above but is unsuccessful with the error:



Element 'css=input[accept="image/png,image/jpeg,image/gif,image/bmp"]' not visible after 30 seconds.


Increasing the timeout also doesn't work. Using the same in Chrome Dev Tools would successfully find the element. My guess is that the commas/slashes are messing with Robot's locator parsing. My question is: What is the correct way to write the locator?







selenium automated-tests robotframework






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 3:19









jeffsia

951315




951315








  • 1




    The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with Page Should Contain Element.
    – Todor
    Nov 20 at 5:07










  • @Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
    – jeffsia
    Nov 20 at 5:27














  • 1




    The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with Page Should Contain Element.
    – Todor
    Nov 20 at 5:07










  • @Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
    – jeffsia
    Nov 20 at 5:27








1




1




The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with Page Should Contain Element.
– Todor
Nov 20 at 5:07




The content of the locator is used as is, RF doesn't have any issues with the commas or the slashes. It should be something else - the element is shown after some interaction, or it is simply not visible, just present - a more "stylized" span or div is what the user sees. Try with Page Should Contain Element.
– Todor
Nov 20 at 5:07












@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 at 5:27




@Todor I changed the validation to use the keyword Wait Until Page Contains Element and it worked! It looks like Selenium/Robot recognizes input tags that are not text fields as not visible even though they appear in the DOM.
– jeffsia
Nov 20 at 5:27












2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input elements - the UI renders something different, a button, div that had applied styling and fits in better with the overall design.



Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element keyword, and proceed on success.






share|improve this answer






























    up vote
    0
    down vote













    There is no problem with the CSS locator your are using. Maybe the element is in another iframe?






    share|improve this answer





















    • The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
      – jeffsia
      Nov 20 at 5:17











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385720%2frobot-framework-locating-input-element-with-accept-attribute-fails%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input elements - the UI renders something different, a button, div that had applied styling and fits in better with the overall design.



    Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element keyword, and proceed on success.






    share|improve this answer



























      up vote
      2
      down vote



      accepted










      Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input elements - the UI renders something different, a button, div that had applied styling and fits in better with the overall design.



      Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element keyword, and proceed on success.






      share|improve this answer

























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input elements - the UI renders something different, a button, div that had applied styling and fits in better with the overall design.



        Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element keyword, and proceed on success.






        share|improve this answer














        Though present in the DOM, an element may not be visible/rendered. This is very often the case with file upload input elements - the UI renders something different, a button, div that had applied styling and fits in better with the overall design.



        Thus a check is it visible will rightfully fail. Change your pre-usage approach to validate the input is in the HTML - this is actually the same as what you did in the browser's dev tools - with the Page Should Contain Element keyword, and proceed on success.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 20 at 6:11

























        answered Nov 20 at 5:52









        Todor

        5,2522033




        5,2522033
























            up vote
            0
            down vote













            There is no problem with the CSS locator your are using. Maybe the element is in another iframe?






            share|improve this answer





















            • The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
              – jeffsia
              Nov 20 at 5:17















            up vote
            0
            down vote













            There is no problem with the CSS locator your are using. Maybe the element is in another iframe?






            share|improve this answer





















            • The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
              – jeffsia
              Nov 20 at 5:17













            up vote
            0
            down vote










            up vote
            0
            down vote









            There is no problem with the CSS locator your are using. Maybe the element is in another iframe?






            share|improve this answer












            There is no problem with the CSS locator your are using. Maybe the element is in another iframe?







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 20 at 5:13









            thanh le

            1495




            1495












            • The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
              – jeffsia
              Nov 20 at 5:17


















            • The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
              – jeffsia
              Nov 20 at 5:17
















            The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
            – jeffsia
            Nov 20 at 5:17




            The content is not inside an iframe. There are other element likes buttons grouped inside the same div as the input element and I can find them just fine.
            – jeffsia
            Nov 20 at 5:17


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385720%2frobot-framework-locating-input-element-with-accept-attribute-fails%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Costa Masnaga

            Fotorealismo

            Sidney Franklin