I'm just trying to figure out if anyone has successfully completed this. From what I'm seeing id's are randomly generated and not static for each test run.

Causing issues identifying iframes on the page, and practically everything is in a iframe, causing problems trying to click elements on the page.

Would anyone have any suggestions ?

1 Answer 1


Although it takes some work it is possible to make a robust set of tests against the service console. You will need to take some time to build a framework, but once you have this it will make all your tests far easier to write.

The basic formula is to use the JavaScriptExecutor feature of WebDriver to control and find elements from the console by calling the Console Integration Toolkit. The integration toolkit will give you the unique IDs of the parent DIVs that contain the IFrame you will need.

I am writing this code straight into this answer so you may need to tweak any little syntax errors I have :)

To get started you need to load the toolkit into the page:


    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = '/support/console/37.0/integration.js';    


with the toolkit loaded (and assuming you have a tab open) we can now find the IFrame.


    window.selenium = {};

        window.selenium.tabs = JSON.parse(result.ids);


You can now retrieve the value of the primary tab IDs and find the element.

Object tabId = ((JavascriptExecutor)driver).executeScript("

    return window.selenium.tabs[0]


This will give you the ID of the tab, usually something like scc-pt-0, which you can then use to find the IFrame element using XPath like //div[@id='scc-pt-0']//iframe

  • Thanks very much for the reply. I will try this out and see how I get on and post my results hopefully with success :) Jun 24, 2016 at 13:06
  • 1
    @ThomasWoodhouse - I hope you had some success with this approach. If the answer helped you can you mark it as accepted so that others can see this. Many thanks!
    – Mark Keats
    Jun 29, 2016 at 13:37
  • Yep sorry tried this and it works successfully, I just need to implement it correctly into my page Object model So I know that pages of console will always grab the primaryFocused Iframe Jun 30, 2016 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.