Forum Discussion

pkudrys's avatar
pkudrys
Contributor
2 years ago

How to access elements at "Your connection is not private" Chrome page?

Hi folks,

Is there any way to access and control elements at "Your connection is not private" Chrome page? It seems that the TC Spy is unable to track the Advanced/Back to safety buttons. I found a similar post, regarding this issue, but none of the suggested solutions work for me.

 

Aside of TC, we are using also Ranorex. And although its Spy is also unable to track (by mouse) the elements of this page, the elements are accessible via Spy tree and can be manually added to Ranorex repository. So I'm curious, if TC has a similar capability?

 

13 Replies

  • KB1's avatar
    KB1
    Champion Level 2

    It is not possible to interact with elements on the "Your connection is not private" page in Chrome using TestComplete or any other automation tool, as the page is displayed in a special Chrome browser tab that is not accessible to external programs.

     

    The buttons on this page, such as "Advanced" and "Back to Safety", are implemented using Chrome's native UI elements, which cannot be accessed or controlled using TestComplete or other external automation tools.

     

    If you are using Ranorex and you are able to access and control the elements on this page using the Ranorex Spy, you can try adding the elements to the Ranorex repository and then use them in your tests. However, keep in mind that this may not work reliably, as the page and its elements are not intended to be accessed or controlled by external programs.

    • torus's avatar
      torus
      Contributor

      KB1, this is not correct that not other automation tool could interact with this page. I was able to interact with this page without any issues using Selenium/C#/Nunit. 

       

      Driver.Instance.Navigate().GoToUrl("https://umeu0514/");
      
      var advancedButton = Driver.Instance.FindElement(By.XPath("//button[@id='details-button' and contains(text(),'Advanced')]"));
      advancedButton.Click();

       

       

      Don't get me wrong; I love TestComplete; unbeatable for desktop testing. This was just a bit of a downer that Selenium could do something that TestComplete could not. If you click F12, you can see all of the html elements as plain as day in the Elements tab. And if you go to the developer tab of the developer console and type $x("//button[@id='details-button' and contains(text(),'Advanced')]"), you can verify correctly formatted XPATH

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I know that the latest version of Chrome, TC can not interact with Chrome alert dialogs. It's a known issue, and I really hope that this gets fixed. It must be difficult for Smartbear Dev's to keep up to date with the constant changes that occur in Chrome!

     

    I don't test certificate or restore page issues, as this is specific to the browser. I only test the web application to ensure that it supports the browser our customer use, i.e. Chrome.

    • torus's avatar
      torus
      Contributor

      Is there a feature request for this already? "TC can not interact with Chrome alert dialogs and the connection not private buttons"? I found a work-around (TC contact had a good suggestion) by using OCR to find and click on these buttons. 

  • Thanks for the reply. I too don't test these elements 😉 It's just that they appear from time to time, so I need a solution how to deal with them. Of course, it would be best if the tested webs would have a proper certificate. Sadly, it's not an option for dev sites still under construction. I really hope SB devs will find a solution to this problem.

  • Thank you for the reply. Well, Ranorex is able to control these elements and it works quite well in our tests. Now the big question is, how to deal with such kind of elements in TC? The thing is, it's not just a question of this particular page, but there are also other Chrome UI elements, which needs to be occasionally controlled by tests. For example "Restore pages" popup and similar "native window" elements.

    • Kitt's avatar
      Kitt
      Regular Contributor

      To handle the Chrome "Restore" popup, you can try the following:

      1. Navigate to the following path: C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default
      2. Search Preferences file
      3. Open file with notepad (or similar)
      4. Search the value "exit_type":"Crashed" and change it to "exit_type": "none"
      5. Search "exited_cleanly" and it should be "exited_cleanly":true
      6. Save & Close the preferences file
      7. Right-click on the file and make it read-only else chrome will update this file again with initial values

      I have a brief post on how to run TestComplete using the latest browser version of Chrome and some things you can do to mitigate auto-update [here].

       

      For the issue of bypassing the "connection is not private" page, you can try one of the following:

      1. Click a blank section of the denial page.
      2. Using your keyboard, type "thisisunsafe". This will add the website to a safe list, where you should not be prompted again

      OR 

      This option will only work for requests to localhost over HTTP.

      1. In the Chrome address bar, type “chrome://flags/#allow-insecure-localhost
      2. Select the “Enable” link.

       

      • pkudrys's avatar
        pkudrys
        Contributor

        Thanks for your suggestions. I will definitely try them. I'm just not sure about this one:


        Kitt wrote:

        For the issue of bypassing the "connection is not private" page, you can try one of the following:

        1. Click a blank section of the denial page.
        2. Using your keyboard, type "thisisunsafe". This will add the website to a safe list, where you should not be prompted again

        I see no effect of clicking inside the denial page? Where exactly should be entered "thisisunsafe"?