Hi, friends.
How do I add these to “if-then-else” when the search isn’t found? Thanks
use Get Text activity and indicate no results found position. And it will give you output of type String and say ‘searchResult’
If searchResult.Contains(“No result found”)
Then data not found
Else Found it.
Ok, so do I need to add any variable?
Yes create one variable of type string and store output of Get Text activity into it.
So, what you mean is the variable is NoSearchResult, right?
You can declare variable name anything but it should be of type ‘String’.
Ok, so the GetText of no result found should before the *If-then-else?
-
Type Salesperson’s Mobile Number
-
Click Search
-
use Get Text activity and indicate that position to read status like whether data found or not. And store result in a string variable say ‘searchResult’
If searchResult.Contains("No result found") Then: Results not found Else: Results found
Yes you’re right.
Important thing is when you use ‘Get Text’ activity, don’t use the value attribute in selector if the value was dynamically change.
TanQ,
Michael Udhaya
I did use the Get text to indicate the no result found but the error will still appear after the Search is clicked
PS: The Get textthat to indicate the No result found must be inside the If-then-else ?
get text activity must be before if condition…
also I would like to advise to you take basic training so that you can have better understanding of what to do, when to do, how to do…
https://academy.uipath.com/learn/public/learning_plan/view/35/RPADeveloper
So, Do I need to input 2 Get Text into the process when I have 2 conditions?
if your condition is checking for two different things then yes…
Thanks, Friends! I think one of the condition is work when my “No result found”. However, when condition 2 is meet which is the result is found but the system showed the error again.
How should I do to let the system to run when the condition 2 is meet?
@KunSeng let me explain.
- You enter some values in text box and Click the Search button.
- Use the ‘Element Exists’ activity to check the “No Results Found”.(use aaname attribute for better selector)
- Get the Boolean variable of ‘Element Exists’ and paste it in the ‘If condition’.
- In the ‘Then’ block simply put a ‘Log Message’ for your reference.
- In the Else block you can do the data scraping or what do you want.
Surly it will work. Let me know once you got.
TanQ,
Michael Udhaya