cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to navigate to page

Frequent Contributor

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 12
Occasional Contributor

RE: Unable to navigate to page


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!

Frequent Contributor

RE: Unable to navigate to page

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... 
Contributor

RE: Unable to navigate to page

In my tests I use:



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




I open it with :  



Browsers.Item(btChrome).Run();


 


and to navigate I use:



Browsers.CurrentBrowser.Navigate("http://mywebsite.com");



Maybe using these would help?

Occasional Contributor

RE: Unable to navigate to page

@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 ?
O_o
Frequent Contributor

RE: Unable to navigate to page

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.
Super Contributor

Re: RE: Unable to navigate to page

@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.

Frequent Contributor

Re: RE: Unable to navigate to page

@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
Community Manager

Re: Unable to navigate to page

Thanks for sharing your solution with us, @rgratis 

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Highlighted
Frequent Contributor

Re: RE: Unable to navigate to page

Forgot to mention above that the registry key edits also set the automation to run on reboot by entering a task script.  I discovered that often tests were not running correctly when placed directly in the task.vbs file because the Windows desktop was not initializing. It turns out that the startup tasks placed in the registry must end before Windows continues startup.

I got around this by using task.vbs to call a second script. This way, the startup command for task.vbs completes very quickly. Windows finishes starting up after task.vbs is done. Meanwhile, the second script has a wait time in it to let Windows finish before running its own commands.

See task-sample.vbs for an example of calling another script. This will be "task.vbs". Then see task-script-sample.vbs for an idea of what complex things you can do in your second script. The name of this script does not matter, so long as you call it from task.vbs.

 

CC @nisgupta