Forum Discussion

rgratis's avatar
rgratis
Frequent Contributor
11 years ago

Unable to navigate to page

I recently started developing my first web testing scripts, and I have run into an issue.  My first simple script is failing when run on our testing platform.  The script does not fail when I run it on my own computer, so it's proving more difficult to troubleshoot.



The testing platform is a bit slower than my computer, and I suspect that the Browser.ToURL call I'm making in my script is being executed too quickly after I start up the browser.  Here are the error messages I'm receiving:



Script:

Set Page = Browser.ToUrl("<my url here>", 90000)



Internet Explorer:


Unable to navigate to the <my url here> page.

URL: <my url here>

Process ID: 3368

Process Command Line: "C:\Program Files\Internet Explorer\IEXPLORE.EXE"

Info: Cannot find any visible Page node.



Sys.Browser("iexplore")



Chrome:


Unable to navigate to the <my url here> page.

URL: <my url here>

Process ID: 5816

Process Command Line: "C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-hang-monitor

Info: Cannot find any existing or open blank page.



Sys.Browser("chrome")



The screenshots that accompany the error messages clearly show the browser on screen.  The call appears to time out after 30 seconds, even though I am passing the timeout value 90000.



Any suggestions?

Thanks.



12 Replies

  • vbarros's avatar
    vbarros
    Occasional Contributor

    Try calling the browser and saved by creating TestApps.


     


    Follow the steps below and see if it helps:


     


    1 - right-click on the project


    2 - Click Add


    3 - Click New Item


    4 - Select the TestedApps


    5 - Click Ok


     


    Appear in the project TestedApps


     


    1 - Click on TestedApps Right


    2 - Click on New Item


    3 - In the Application field put the path to the executable of the browser (Example: C: \ Program Files (x86) \ Internet Explorer \ iexplore.exe)


    4 - Click OK


     


    Now whenever you want you can use the following commands in your script:


     


    TestedApps.iexplore.Run () / / / To open the browser


     


    Sys.Process ("iexplore"). ToUrl ("www.google.com.br") / / / To execute URL.


     


     


    Hope this helps!

  • rgratis's avatar
    rgratis
    Frequent Contributor
    According to the documentation, using browsers as tested applications is an older format that is being moved away from.  I would like to continue troubleshooting this through the new Browsers/Browser objects.



    I'm going to have someone run through all the browser preparation steps again on the test platform today.  Perhaps something was overlooked in the environment setup... 
  • sonali_suhani's avatar
    sonali_suhani
    Occasional Contributor
    @KimPenta : even i'm facing the same problem with the navigation o pags and the command 

    Browser.CurrentBrowser.Navigate() is also not working.

    Is there any other way we can solve th issue ?
  • rgratis's avatar
    rgratis
    Frequent Contributor
    In our case, this ended up being an issue with the configuration of the test platform.  We had overlooked installing the required browser patches/extensions and completing all the browser preparation steps detailed in the help.



    http://support.smartbear.com/viewarticle/26786/



    There was also a problem when trying to trigger the test job remotely in that a real desktop session was not being initiated, which we resolved.
    • nisgupta's avatar
      nisgupta
      Valued Contributor

      rgratis 

       

      How did you resolve this ?

      We are running the tests on remote testexecute machines . Bu wen we disconnect the remote desktop then our tests . Test fails as soon as the firefox browser is launched .

       

      We do have the problem when the Remote desktop window remain open.

      • rgratis's avatar
        rgratis
        Frequent Contributor

        nisgupta , we did an admin hack where we set registry keys on Windows machine for auto admin login on restart, then reboot.  At end of test, we ran script that unset those keys and rebooted to lock machine again.

        This was done a very long time ago and we no longer use TestComplete, so not certain if will work still.  Note that some of these script commands use project variables set up in TestComplete, so you will have to implement or substitute actual values.

         

        Sub SetUpDailyRun
        ' Prepares for the automated test run by enabling auto-logon
        ' and setting a task to execute for TestComplete
        ' before rebooting the PC
          Dim regKey
          
          If aqEnvironment.IsPluginInstalled("Storages") = True And aqEnvironment.IsPluginInstalled("Win32API") = True And aqEnvironment.IsScriptExtensionInstalled("WMI Object") = True Then
            
            Set regKey = Storages.Registry("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", HKEY_LOCAL_MACHINE, getRegArch())
            
            Call regKey.SetOption("AutoAdminLogon", "1")
            If regKey.GetOption("AutoAdminLogon", "<none>") <> "1" Then Log.Error "Failed to set ""AutoAdminLogon""."
        
            Call regKey.SetOption("AutoLogonCount", "1")
            If regKey.GetOption("AutoLogonCount", "<none>") <> "1" Then Log.Error "Failed to set ""AutoLogonCount""."
          
            Call regKey.SetOption("DefaultUserName", Project.Variables.WinUser)
            If regKey.GetOption("DefaultUserName", "<none>") <> Project.Variables.WinUser Then Log.Error "Failed to set ""DefaultUserName""."
          
            Call regKey.SetOption("DefaultPassword", Project.Variables.WinPassword)
            If regKey.GetOption("DefaultPassword", "<none>") <> Project.Variables.WinPassword Then Log.Error "Failed to set ""DefaultPassword""."
          
            Call regKey.SetOption("DefaultDomainName", Project.Variables.WinDomain)
            If regKey.GetOption("DefaultDomainName", "<none>") <> Project.Variables.WinDomain Then Log.Error "Failed to set ""DefaultDomainName""."
          
          
            Set regKey = Storages.Registry("SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\", HKEY_LOCAL_MACHINE, getRegArch())
          
            Call regKey.SetOption("TestCompleteTask", """" & aqFileSystem.IncludeTrailingBackSlash(Project.Path) & "task.vbs" & """")
            If regKey.GetOption("TestCompleteTask", "<none>") <> """" & aqFileSystem.IncludeTrailingBackSlash(Project.Path) & "task.vbs" & """" Then Log.Error "Failed to set ""TestCompleteTask""."
          
            ' This call stopped working in 06/2013
            ' for running when user logged out
            'Call Sys.Restart()
          
            Call WMI.RestartComputer()
            
          Else
          
            Log.Error "Required extensions are not installed.", "You must enable ""Storages"" Extension, ""Win32API"" Extension, and ""WMI"" Script Extension."
            
          End If
          
        End Sub 'SetUpDailyRun
        
        
        Sub CleanUpDailyRun
        ' Cleans up after an automated run by
        ' disabling auto-logon
        ' and deleting the TestComplete task
        ' before rebooting
          Dim regKey
          
          If aqEnvironment.IsPluginInstalled("Storages") = True And aqEnvironment.IsPluginInstalled("Win32API") = True Then
        
            Set regKey = Storages.Registry("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\", HKEY_LOCAL_MACHINE, getRegArch())
        
            Call regKey.SetOption("AutoAdminLogon", "0")
            If regKey.GetOption("AutoAdminLogon", "<none>") <> "0" Then Log.Error "Failed to set ""AutoAdminLogon""."
          
            Call regKey.RemoveOption("AutoLogonCount")
            If regKey.GetOption("AutoLogonCount", "<none>") <> "<none>" Then Log.Error "Failed to delete ""AutoLogonCount""."
          
            Call regKey.RemoveOption("DefaultUserName")
            If regKey.GetOption("DefaultUserName", "<none>") <> "<none>" Then Log.Error "Failed to delete ""DefaultUserName""."
        
            Call regKey.RemoveOption("DefaultPassword")
            If regKey.GetOption("DefaultPassword", "<none>") <> "<none>" Then Log.Error "Failed to delete ""DefaultPassword""."
        
            Call regKey.RemoveOption("DefaultDomainName")
            If regKey.GetOption("DefaultDomainName", "<none>") <> "<none>" Then Log.Error "Failed to delete ""DefaultDomainName""."
          
            Set regKey = Storages.Registry("SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\", HKEY_LOCAL_MACHINE, getRegArch())
          
            Call regKey.RemoveOption("TestCompleteTask")
            If regKey.GetOption("TestCompleteTask", "<none>") <> "<none>" Then Log.Error "Failed to delete ""TestCompleteTask""."
          
          
            Call Sys.Restart()
          
          Else
          
            Log.Error "Required extensions are not installed.", "You must enable ""Storages"" Extension and ""Win32API"" Extension."
            
          End If
        
        End Sub 'CleanUpDailyRun
        
        
        Function getRegArch()
        ' Returns constant for registry architecture for use in Storages.Registry
        
          If Sys.OSInfo.Windows64bit = True Then
            getRegArch = AQRT_64_BIT
          Else
            getRegArch = AQRT_32_BIT
          End If
        
        End Function 'getRegArch