Micro Focus QTP (UFT) Forums
Can some one check my code and tell me whats wrong in it. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Can some one check my code and tell me whats wrong in it. (/Thread-Can-some-one-check-my-code-and-tell-me-whats-wrong-in-it)



Can some one check my code and tell me whats wrong in it. - zakshah.12 - 02-26-2013

When i login successfully loop stays on and keep looking for error msg and then throw an error msg.
Cannot identify the object "Please correct the marked field(s) below." (of class WebElement). Verify that this object's properties match an object currently displayed in your application.

Line (15): "
Code:
Browser("World's Largest Professional").Page("Sign In | LinkedIn").WebElement("Please correct the marked field(s) below.").Output CheckPoint("msgerror")".

Tip: If the objects in your application have changed, the Maintenance Run Mode can
help you identify and update your steps and/or the objects in your repository.









Code:
Dim bro,url
bro = "iexplore"
url = "www.linkedin.com"

Systemutil.Run bro,url

For i = 1 To datatable.GetRowCount Step 1
Browser("World's Largest Professional").Page("World's Largest Professional").WebEdit("session_key").Set datatable( "user")
wait 3
Browser("World's Largest Professional").Page("World's Largest Professional").WebEdit("session_password").Set datatable ("pass")
wait 3
'Browser("World's Largest Professional").Page("Sign In | LinkedIn").WebButton("Sign In").Click
Browser("World's Largest Professional").Page("World's Largest Professional").WebButton("Sign In").Click
If Browser("World's Largest Professional").Page("Sign In | LinkedIn"). Exist Then
   Browser("World's Largest Professional").Page("Sign In | LinkedIn").WebElement("Please correct the marked field(s) below.").Output CheckPoint("msgerror")
   Browser("World's Largest Professional").Page("Sign In | LinkedIn").WebButton("Sign In").Click
    Else
             Browser("World's Largest Professional").Page("(14) Welcome! | LinkedIn").WebElement("Account Type:").Check CheckPoint("Account Type:")
'             Browser("World's Largest Professional").Page("(14) Welcome! | LinkedIn").Sync
             Browser("World's Largest Professional").CloseAllTabs
              End If
              Datatable.SetNextRow
Next



RE: Can some one check my code and tell me whats wrong in it. - basanth27 - 02-26-2013

The validation for the below code should include another object which will uniquely identify your condition. ,
Code:
If Browser("World's Largest Professional").Page("Sign In | LinkedIn"). Exist

Code:
If Browser("World's Largest Professional").Page("Sign In | LinkedIn")..WebButton("Sign In").Exist

This will check for the sign in button and if it exists it would mean that there are required fields else, on a successful page it will not have this button.

Helps?


RE: Can some one check my code and tell me whats wrong in it. - zakshah.12 - 03-05-2013

it is not working


RE: Can some one check my code and tell me whats wrong in it. - newqtp - 03-06-2013

Instead of checking whether page exist after unsuccessfull login by this code If Browser("World's Largest Professional").Page("Sign In | LinkedIn"). Exist
try below
if Browser("World's Largest Professional").Page("World's Largest Professional").WebEdit("session_key").Exist then capture error msg

as you are unable to login then your page still have sign and password webedit.