hi ,
In above program after each link clicked, as a effect of click on the links some time new web window will open and some time the Content of main page will change.
i need to check after clicking a link no error should be displayed in the web page
i used the below program to find whether any error occured in the web page. I called a program which will return false if any error occured in the page. then in main progrma i can write lik if error occured then just click on log off button so that it should lead to same page as it was before the occurance of error.
Here control is not going inside the statement--
If IsPageCannotBeDisplayed(oBrw,PCD_Keywords) Then
And also i am passing the argument oBrw as same all the time, how can i pass the web page name which is currently opened (it may be new Web page window or the same page where the data chanaged)
Below is the program where i changed
Bold letters are same as you mentioned in the above program
For k = 0 to LinkCount-1
objLinks(k).Click
Next
' Function which i am calling
In above program after each link clicked, as a effect of click on the links some time new web window will open and some time the Content of main page will change.
i need to check after clicking a link no error should be displayed in the web page
i used the below program to find whether any error occured in the web page. I called a program which will return false if any error occured in the page. then in main progrma i can write lik if error occured then just click on log off button so that it should lead to same page as it was before the occurance of error.
Here control is not going inside the statement--
If IsPageCannotBeDisplayed(oBrw,PCD_Keywords) Then
And also i am passing the argument oBrw as same all the time, how can i pass the web page name which is currently opened (it may be new Web page window or the same page where the data chanaged)
Below is the program where i changed
Bold letters are same as you mentioned in the above program
For k = 0 to LinkCount-1
objLinks(k).Click
Code:
Set oBrw = Browser("A").Page("B")
If IsPageCannotBeDisplayed(oBrw,PCD_Keywords) Then
Browser("A").Page("B").Frame
("corner").Link("Log off").Click
End If
Next
' Function which i am calling
Code:
Public Function IsPageCannotBeDisplayed (oBrw,PCD_Keywords)
Dim sUrl,sPageText,oPg
IsPageCannotBeDisplayed = False
If Not oBrw.Exist(0) Then
Exit Function
End If
'Get the page object
Set oPg = oBrw.Page("micclass:=Page")
'A page might not exist when the dialog modal is present
'in the browser
If Not oPg.Exist(0) Then
Exit Function
End If
sURL = oBrw.Page("micclass:=Page").GetROProperty("URL")
'Special check for IE and FF URL checks
If InStr(1,sURL,"shdoclc.dll",vbTextCompare) <> 0 Or InStr(1,sURL,"about:neterror?",vbTextCompare) <> 0 Then
IsPageCannotBeDisplayed = True
'IF IE then we will use HTML DOM to get the whole page text
ElseIf InStr(1,oBrw.GetROProperty("version"),"internet explorer",vbTextCompare) Then
sPageText = oPg.Object.documentElement.outerText
End If
Dim sKeyword
For Each sKeyword In PCD_Keywords
'Check if our keyword exist on the page
If InStr(1,sPageText,sKeyword,vbTextCompare) Then
IsPageCannotBeDisplayed = True
Exit Function
End If
Next
End Function
Dim PCD_Keywords
PCD_Keywords = Array("The page cannot be displayed","Sorry page is not found","error")