Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Select Frame into another Frame

rvmseng
rvmseng Posts: 89
edited December 2018 in SOAtest

Dear Support,

I want to know how can I select a Frame into another Frame, please refer to attached picture.
In the below picture the "workframe" is into "mainframe".


Comments

  • rvmseng
    rvmseng Posts: 89

    Dears,

    please assist me.

  • tony
    tony Posts: 25 ✭✭

    SOAtest does not have the ability to select frames. Instead SOAtest will automatically traverse frames and interact with the first element that matches the criteria given in the Element Locator.

    If SOAtest is finding the wrong element, try adding more detail to your element locator. For example, there may be a distinct parent element that differentiates the element you are trying to find from the wrong element. Then you could use an xpath like

    //parent[@attribute='parentValue']//input[@id='custom_field_0_64']
    

    Alternately, you may be able to use an Execute JavaScript action to traverse the frames and interact with the element of interest if they are all on the same domain. For example, this code finds a button inside a frame:

    var theFrame = document.getElementsByTagName("frame")[0];
    var theFrameDocument = theFrame.contentDocument || theFrame.contentWindow.document;
    var button = theFrameDocument.getElementById("mybutton");
    
  • rvmseng
    rvmseng Posts: 89
    edited January 2019

    Dear,

    Unfortunately I cannot parameterize values in "Execute JavaScript action", please refer to following sample code:

    function setText(input){
        var mainframe=window.frames["mainframe"].document;
        var workframe=mainframe.getElementsByName("workframe")[0];
    
        var elms=workframe.contentDocument.getElementsByName("custom_field_0_62");
        elms[0].value="${myVar}";
    }
    

    Also I cannot use "context.getValue()" in Execute JavaScript action.

    https://forums.parasoft.com/discussion/comment/11107#Comment_11107

  • rvmseng
    rvmseng Posts: 89

    I think this is very big fault, because we cannot access to internal frames, and if we want to use "Execute JavaScript action", unfortunately we cannot parameterize values.

  • tony
    tony Posts: 25 ✭✭

    we cannot access to internal frames

    To be clear, you can access internal frames. SOAtest automatically traverses all frames when looking for an element. You do not need to specify a frame for that to happen. If SOAtest is not finding your element, then that is an issue with your element locator and has nothing to do with frames.

  • rvmseng
    rvmseng Posts: 89
    edited January 2019

    Dear Tony,

    I tested many different state and I found that SOATest cannot find elements in inner frames, It only determine elements in main frame not inner frames. you can test it.

    Also I want to use XPATH for addressing inner frames, but unfortunately XPATH doesn't have this ability.

    https://stackoverflow.com/questions/9942928/how-to-handle-iframe-in-selenium-webdriver-using-java

  • jakubiak
    jakubiak Posts: 795 admin

    Tony's understanding is correct - SOAtest can find elements in inner frames in general. It is not clear why it is not working for you. I would recommend you contact SOAtest support to follow up on this issue because there is probably something specific to your test case that needs to be worked out.