Forum Discussion

sohailalam2696's avatar
sohailalam2696
Contributor
2 months ago
Solved

How to open Dev Tools using Test Complete?

These are the steps I tried but did not work.

{
  //Opens the specified URL in a running instance of the specified browser.
  //Browsers.Item(btChrome).Navigate("https://example.com/");

  //Clicks the 'BrowserWindow' object.

// Pressing Ctrl+Shift+F to open find dialog
//function sendCtrlShiftI() {
    // Press and hold Ctrl and Shift keys, then press I, and release all keys
   // aqUtils.SendKeys("^+I");
   
}

function Test1() {
    // Opens the specified URL in a running instance of the specified browser.
    Browsers.Item(btChrome).Navigate("https://example.com/");

    // Accessing Chrome's Developer Tools using TestComplete
    var page = Sys.Browser("chrome").Page("https://example.com/");

    // Execute JavaScript to open Chrome Developer Tools
    Sys.Keys(^+I);
   // page.RunBrowserCommand("Developer Tools");

    // Alternatively, you can use the following line to open the Developer Tools:
    // page.Keys("^+I");
}

  • You could just do:

    function openDevTools() {
      Sys.Browser("chrome").Page("*").Keys("[F12]")
    }

9 Replies

  • nastester's avatar
    nastester
    Regular Contributor

    You could just do:

    function openDevTools() {
      Sys.Browser("chrome").Page("*").Keys("[F12]")
    }

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    To launch Chromes' DevTools, you need to press F12 on the BrowserWindow and not the Page object,

    Sys.Browser("chrome").BrowserWindow(0).Keys('[F12]')

    Object Spy is able to  identify the DevTools window as Sys.Browser("chrome").BrowserWindow(1).Window("Chrome_RenderWidgetHostHWND", "Chrome Legacy Window", 1) but not any of the UI controls.

    • nastester's avatar
      nastester
      Regular Contributor

      It absolutely works on the Page object. I did it yesterday. 

      • sohailalam2696's avatar
        sohailalam2696
        Contributor

        so you are saying we cannot go to other tabs like Performance or Console?

        Thanks