Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script
#1
Solved: 11 Years, 4 Months ago
Hi, I want the system to click on a link "Apply", but if that link doesn't exist I want the system to click on a link "Close".

The "test" is applying for a job and if the "test" has already applied for just that job, the button "Apply" doesn't exist.

I have written following

Code:
If
Browser("Njord Web Portal - Job_2").Page("Njord WebPortal - Job").Link("Apply") Then .Click

Else
Browser("Njord Web Portal - Job_2").Page("Njord Web Portal - Job").Link("Close").Click

End If

[/i]but I receive Syntax error. Why?

I'm greatful all tips I can get.

Ann Hagglund
Reply
#2
Solved: 11 Years, 4 Months ago
Hi,
write it as
Code:
If Browser("Njord Web Portal - Job_2").Page("Njord WebPortal - Job").Link("Apply").Exists Then
     Browser("Njord Web Portal - Job_2").Page("Njord WebPortal - Job").Link("Apply").Click
  Else
     if Browser("Njord Web Portal - Job_2").Page("Njord Web Portal - Job").Link("Close").Exists Then
            Browser("Njord Web Portal - Job_2").Page("Njord Web Portal - Job").Link("Close").Click
     end if
  end if
Reply
#3
Solved: 11 Years, 4 Months ago
Hi,

The If condition in Else can be omited.
Reply
#4
Solved: 11 Years, 4 Months ago
Hi again,
Thank you for your quick answer but unfortunately I receive an error message in accordance to my attachment:


Attached Files Image(s)
   
Reply
#5
Solved: 11 Years, 4 Months ago
this error is related to page object which is not found in the object repository . once this object found then use :
Code:
B().P().Webedit().Type Date
or
B().P().Webedit().Type "20/04/2011"
or
B().P().Webedit().Type "20042011"
Reply
#6
Solved: 11 Years, 4 Months ago
Hi Ann,

Use if condition to click on the link.

Code:
If Browser().Page().Link().Exists(5) Then

Browser().Page().Link().Click

End If

Note: Add Objects to OR Before you run above script.


Thanks,
Reply
#7
Solved: 11 Years, 4 Months ago
[/quote]Hi again,
I have now stated that the object is in Object repository but now I receive the following error message: See attachment.


Hi again,
I received an error message regarding that the object doesn't support...., see below.

Another question, I am a real beginner, what do you mean with
"Add Objects to OR Before you run above script".

Sorry to bother you again!

Thank you for your help!!!
Ann Hagglund
Adecco Sweden


Hi again,
I know what OR means. Sorry for that. The object is already in Object Respository, I have checked that.


Best regards,
AnnSmile


Attached Files Image(s)
   
Reply
#8
Solved: 11 Years, 4 Months ago
Hi,
Sorry.... It's link().Exist instead of link.Exists Tongue
Reply
#9
Solved: 11 Years, 4 Months ago
Hi again!
I'm so happy, it works now. Thank you for all your help!Smile

Reply
#10
Solved: 11 Years, 4 Months ago
Hi there!

You're welcome . this helps in resolving your issue.

Have a great day!
Thank you !!!
UFTEnthusiast
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)